WordPress.org

Ready to get started?Download WordPress

Forums

Can't select templates (5 posts)

  1. Tyssen
    Member
    Posted 5 years ago #

    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?

  2. stvwlf
    Member
    Posted 5 years ago #

    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.

  3. stvwlf
    Member
    Posted 5 years ago #

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

  4. Tyssen
    Member
    Posted 5 years ago #

    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 :?

  5. stvwlf
    Member
    Posted 5 years ago #

    Hi

    Whatever works!

Topic Closed

This topic has been closed to new replies.

About this Topic