Page template not listed

I created a page template as described in the documentation here. Nothing fancy, basically just experimenting with the functionality.

To my surprise, the template is not listed when adding a new page, or quick editing a page. Thinking it might be something within the page template I used as blank one, with the same results.

/* Template Name: Section Template */

// Load the document. Always Keep this at the bottom of the page template.

Curiously, the Typography template Thierry was so kind to provide is listed as page template. Duplicating it and editing for name results in a page template which unlike its twin also is not listed in WP. I checked the Codex to see if I was perhaps getting in the way of template hierarchy, but no.

I'm a bit baffled. What am I overlooking?

Have you named your template files in that way: page-{slug}.php

Hey J.C.

As Jochen mentioned, you named your template file page-section.php which is conflicting with the "reserved" template file names. Here is the list of all the template files name which are "reserved" and recognised by WP. If you want to add a Custom Template which appears in admin Templates dropdown, you have to make sure that your template file name doesn't conflict with the "reverved" WP template files name (for example jc-section.php.

For instance, the name you used would be automatically assigning your page template for a page called Section (experimentation: add a page called Section and you will see that your template is automatically loading without you doing anything else in the admin). If you scroll to page-{slug}.php in the link mentioned above, you will see that it says:

The page slug template is used when visitors request a specific page, for example one with the “about” slug (page-about.php).

Hope that helps,

Yes, I'd been experimenting with reserved names and custom templates via the Codex 🙂 The section slug was for that specific page. But once I figured out that the Typography template also wasn't working I figured something was amiss. I rebuilt the c9 vm - and magically everything worked as both intended and expected.

I am glad to hear you sorted it out, magically 🙂

Write a reply

Login or register to write a reply, it's free!