Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I incorrectly updated the Template variable in the style sheet of a Child theme. However, the site was still OK. The only indication I had was in the Admin section it said this theme did not exist.

So, my question is - is this variable actually used when rendering a page or is it just a hint for the control panel to notify the user?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

That "Template" line... this one...

Template:     twentyfourteen

... is a required field for child themes. That is what tells WordPress that this is a child and not a stand-alone theme, and also which theme to use as a parent. Files not replaced by the child theme are loaded from the parent.

Without that "Template" line you are bound to have problems but how many problems you have depends (I am speculating) on how much the child depends on the parent. If the child replaces only one or two parent files you may have a lot of trouble. If the child replaces nearly everything, you may not notice the problem. And of course a lot depends on which files are replaced and which should load from the parent.

Reference: https://codex.wordpress.org/Child_Themes

share|improve this answer
    
In your child theme style.css you need minimum two lines in the top comments: theme name: and template: These two lines tell the admin section how to manage the child theme. –  zipzit Apr 25 at 19:37
    
@zipzit: yes, those are the only required lines but the question as I understand it was only about the "Template" line. –  s_ha_dum Apr 25 at 19:43

The choice of parent and child theme is persistently stored in template and stylesheet options. So even if you break child theme in this way it's not immediately problematic because it is still "remembered" as such.

However that obviously doesn't mean it's not broken and is not by any stretch normal mode of operation.

So answering your question literally — no, it's not used in every page load directly. However it is important information which is required for child theme.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.