Support » Themes and Templates » Can’t select templates

  • I’ve just been working on a new theme and created a template for the home page with

    <?php
    /*
    Template Name: Home page
    */
    ?>

    at the top and this worked fine. Then I made some changes to other theme files and created a new template file in the same format and now I can’t select any templates for my pages, not even the default links or archives templates.

    I tried deleting the new templates I’d made and undoing the changes I’d made to other files but I still can’t get the list of templates back.

    Anyone know what might be going on and how to go about resolving it?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi

    WP reads the top comment code on all the files in the theme folder to see if you have any custom templates. If something is messed up in some of the template comments it could potentially throw WP for a loop.
    (Your code above is correct as written)

    If it doesn’t see any pages with the template comment it does not display the Template dropdown when you are editing a page. So double check all the files you’ve been working on, including the default template files that are not custom ones, to make sure you didn’t mess something up. Also, make sure you didn’t accidently create 2 customer files with the same Template Name.

    oops – accidently create 2 CUSTOM files with the same Template Name.

    Turns out there was nothing wrong with my templates, but I had to deactivate the theme and then reactivate it again for WP to list the custom templates 😕

    Hi

    Whatever works!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can’t select templates’ is closed to new replies.