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?


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

  • 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 '14 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 '14 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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