WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] General question about WP Pages using theme dir .php files (2 posts)

  1. ixwa
    Member
    Posted 3 years ago #

    I understand that WP looks at the theme's directory to determine if there are any template php files that must be used before it reverts to the default single.php, loop.php, sample.php etc pages.

    My basic question question is: Do I create a "hello-there" WP Page in the dashboard and then--if I want to totally customize how this page appears/behaves--I create and manually upload a "hello-there.php" file into my theme directory?

    I had done this with success, but just in the last day I've noticed that WP is reverting to the default file (and the Page content in the Dashboard) instead of looking at the php file I have in th theme directory.

    (Not sure if this could have anything to do with having made a minor change to my permalink structure, but could it be related?)

  2. ixwa
    Member
    Posted 3 years ago #

    Ah, never mind: solved it. Just when you think you're done, you realize that with WP's functionality comes a bit more work:

    For each WP Page you create in the dashboard for which you want total customization, you must create a template file in the theme directory THAT INCLUDES the name of the template (probably create this first), then just choose this template for that page in the dashboard.

    For those reading this, remember to include these lines in the top of the new template document:

    <?php
    /*
    Template Name: Your template name
    *
     * The template for displaying whatever you want.
     * Blah blah
     */
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic