WordPress Template is missing

Recently while working on a custom WordPress theme I kept running into the issue where my theme would become unusable and in my Appearance section of the back end I would get the error “Template is missing” for my theme.

Often you get this error when you are trying to inherit from a theme but the theme cannot be found,  in my case my theme wasn’t inheriting from another so I couldn’t work out why I was getting this error.

Eventually after a lot of careful cross checking I figured it out

I had to remove any comments that contained the string “TEMPLATE:”, this may also be caused by the lower case “template:” but I didn’t test this.

I had comments like this in as part of my stylesheet:

/* TEMPLATE: Sidebar content */

This was causing WordPress to look for a theme that didn’t exist.

I assumed that WordPress would only look in the top comment block for the theme information but i was wrong…

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>