WordPress.org

Ready to get started?Download WordPress

Forums

Page Templates on "Edit" Page (3 posts)

  1. Eric Mann
    Member
    Posted 5 years ago #

    I've been building custom themes for a while now, but I've noticed a problem with page templates. On some of my sites, they show up properly in the page editor in a drop-down menu. On other sites, they are nowhere to be found.

    I've looked into the built-in theme editor and noticed that it's not recognizing the templates as templates in some sites. For example:
    <?php
    /*
    Page Template: Contact Form
    */
    ?>
    ...will be recognized as "Contact Form Page Template" on some sites, but not on others.

    I can override this in the post_meta table directly. For those of you curious, make sure you know the page ID and the filename of your page template. Set the meta ID "_wp_page_template" to be equal to the filename you want to use.

    This works ... but I really don't like having to edit the database directly. Any idea what bug I'm looking at fixing?

  2. MichaelH
    Member
    Posted 5 years ago #

    Don't know why that happens. But changing to something like the WordPress Default Theme, then changing back to your theme seems to make those templates appear in the dropdown.

  3. Eric Mann
    Member
    Posted 5 years ago #

    I tried doing that ... several times ... but without any success. So far I've been sticking with editing the database directly, but that's not anywhere near an ideal solution.

    Oddly enough, even though I edit the post_meta table so my page will be pulling in the page template, the template still doesn't show up in the dropdown menu. On the edit screen, there is no template selector at all. The Quick Edit screen still shows the page is using "Default Template."

    Any idea what bug I'm fighting with?

Topic Closed

This topic has been closed to new replies.

About this Topic