WordPress.org

Support

Support » Themes and Templates » creating a new custom page template

creating a new custom page template

  • freyaluna
    Member

    @freyaluna

    This is possibly a really basic question, but i just can’t figure it out…

    I want to duplicate the page.php template to create a custom page template. WordPress documentation says “To create a new Custom Page Template for a Page you must create a file.”

    My question is this… How do I “create a file”?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Christine Rondeau
    Volunteer Forum Moderator

    @crondeau

    What I usually do is keep a copy of my theme on my computer. I duplicate the page.php in that folder. Rename it, insert the necessary code at the top to create the custom page template and then upload it via FTP.

    @freyaluna ;

    Hope my advice will help you ,

    1. First open your code editor ( mine is dreamweaver ) and just open a new file .

    2. Then do a coding as follow ;

    <?php
    /*
    Template Name: freyaluna_page
    */
    ?>
    
    <?php get_header
    ?>
    
    <?php get_footer
    ?>

    3. Above is the basic structure for a custom page . After saving the file inside your theme’s directory ( ex. twentyEleven/freyaluna_page.php ) , you will see a drop down menu in ‘ADD A NEW PAGE’ page’s right side bar . And you will find this newly created freyaluna_page is listed . So just select it, and make it the page template for your needed page or pages .

    4. But, here just putting this code will just give you a page most probably with header content and footer ( not including all ). So you have to code as you want the page to be . For an example, if you want a photo gallery to be loaded inside this custom made page, you will have to call that photogallery script inside this freyaluna_page.php . The code should be put in between the header and footer , see below ,

    <?php get_header
    ?>
    YOUR PHOTO GALLERY SCRIPT SHOULD BE WRITTEN HERE
    <?php get_footer
    ?>

    Refer http://codex.wordpress.org/Theme_Development#Basic_Templates

    Hope this will be helpful .
    Thanks .
    Mebox .

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘creating a new custom page template’ is closed to new replies.