Forums

[resolved] Custom Template Layout (4 posts)

  1. whajrog
    Member
    Posted 6 months ago #

    hi. I would like to style a page of my blog differently from the themes layout. Several people have referred me to page templates and etc but then i run into php templates and I know very little php code. If I wanted to create a whole new page with a separate look from the theme, what would I need to do this and how would do it?

  2. wspencer
    Member
    Posted 6 months ago #

    You can style individual pages however you want. If you aren't good with coding, it's going to be pretty difficult.

    Check out this page on the Codex about creating custom page templates...

    http://codex.wordpress.org/Pages

  3. whajrog
    Member
    Posted 6 months ago #

    How do I do this spencer?

  4. wspencer
    Member
    Posted 6 months ago #

    Since this is just a help forum, I can only do so much for you. But the basic run down is that you can create as many custom pages as you want as templates. Copy your page.php file and open the copy. At the top, add this line of code....

    <?php
    /* Template Name: Custom Page  */
    ?>

    You can chose any name in place of "Custom Page". Now save that file as page-custom.php (this can be page-"whatever".php. Choice is yours). Upload that file to your theme's directory.

    When you add a new page in the Dashboard, you'll see a section in the editor on the side that says Templates and has a drop-down menu. That menu should now include "Custom Page" (or whatever you named it). If you select that, the new page you are creating will use the custom template of page-custom.php to render the page. You can change whatever you want about your page-custom.php file to display the page however you'd like. Just be sure you don't delete the page.php file (or edit that one). You'll need a baseline page.php for WordPress to fall back on

    Other than that, read up on the Codex to see in more detail how custom page templates work. If you think this answered your question for you, please remember to mark this topic as RESOLVED. Thanks!

Reply

You must log in to post.

About this Topic