WordPress.org

Forums

_wp_page_template keeps being reset (6 posts)

  1. TheMarco
    Member
    Posted 9 years ago #

    Not sure whether this is a known bug but when I set the _wp_page_template key to 'my_template.php' on a page and I edit the page again, the key gets 'reset' to 'default'. There's no way to get it right except for going into the database itself and fix the record in wp_postmeta.

    Am I the only one with this problem?

  2. moshu
    Member
    Posted 9 years ago #

    I don't know if it's a bug or not (tend to think it is) but that _wp_page_template can NOT be used to define the "template" for a post, which you seemingly are trying to do.

  3. TheMarco
    Member
    Posted 9 years ago #

    I'm defining it for a page, not for a post....
    It displays weird behaviour. Sometimes it works if you do it the very first time you create the page. Edit it again and it's set to 'default' again. I've even seen it create two rows in wp_postmeta.

    I'm using a custom template for some static pages. Whenever I edit them I have to rush to phpmysqladmin to fix these entries or the pages will be borked ;)

  4. moshu
    Member
    Posted 9 years ago #

    For defining a template for a Page - create a Page template and then you'll be able to select it on the Write > Write Page panel in Page Options from the dropdown menu. (Note: the dorpdown is not visible if you don't have properly created Page templates other than the default one!)

  5. S.K
    Member
    Posted 9 years ago #

    I did all that as described in the codex and created diferent templates in all the themes. But the drop down menu (in writing page admin menu) doesn't show up when I use certain themes like shadedgrey. When I try with Dark Maple, I get only 3 - default, archive and search, whereas the defaul theme shows the default, archive and links templates.

    Looks weird, or, am I missing something?

    Please help.

  6. aakoch
    Member
    Posted 9 years ago #

    I think I figured it out. In the template file you have to have this as the first thing in the file.
    <?php
    /*
    Template Name: Snarfer
    */
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic