Sometimes creating a page within WordPress can be frustrating because it reformats the post and will sometimes break links or cause things not to display correctly. It can also be difficult to display videos or buttons within a page if you use the rich text editor built into WordPress.

One thing I typically do in these situations is to create a custom page template for certain pages where I need more control over how it displays. One example of this is my advertising page which was created using this method. I wanted to use Paypal buttons for each type of advertisement, and I wasn’t able to do this within the rich text editor that WordPress offers.

So, here is what you need to do. As a quick note, you will need some very basic HTML coding knowledge to write your page by hand, and you will want to make a backup of your theme before attempting this for the first time.

What I did was make a copy of the page.php file within my theme. That is because WordPress uses the page.php file when creating your themes pages. Rename the copy whatever you want, as long as it isn’t already in use (I just went with advertise.php in my situation). Now you will need to name the PHP file. Once that is done, go to the middle of the PHP file you’ve created and delete out the content code, which usually looks something like this:

<?php the_content(__('[Read more]'));?>

This code might vary a little based upon the theme you are using, so it may not appear exactly like this. Now, you’ll want to paste the text/code you want to use on your custom page. Once you’ve got it how you want it, you’ll want to upload it to your site.

WordPress Page TemplateThe next thing you need to do is to create a new page in your WordPress dashboard like you normally would. Once you’ve created a title, leave the rich text editor blank and go to the Page Template drop-down box in the right menu. Locate the named page you created earlier in the drop-down menu and select it. Now publish your page.

You’re done! Go check your site to see how it looks and make adjustments as needed.

Hopefully I explained this well enough. If you have any questions, please post them below and I’ll do my best to answer them, or will update the post accordingly.

Kyle Eslick is WordPress enthusiast who took his passion for WordPress to the next level in 2007 by launching WPHacks.com as a place to share hacks, tutorials, etc. Follow Kyle on Twitter @KyleEslick!

  1. Jed says:

    How’s about custom template per category? I saw a post in the past and tried it. They have not been updated lately for WP 2.3, etc so write about it that would help us to customize more designs on categories to match its own theme.

  2. Jermayn says:

    Customised pages? cannot you use css and php on the one page template and that will not require you to create extra page templates.

  3. Calaelen says:

    Is this still working with wp2.5?
    I can’t find a page template section in the posting page anymore? 😮

  4. Bob says:

    To Calaelen:
    Page templates still work fine in WP 2.5. I’m new to WP so version 2.5 is the first version I’ve used. I’ve created a couple of page templates and they work fine.

    To Jermayn:
    You could use the one page template supplied by default as it does allow you to insert CSS and PHP. To make sure that any “normal” pages continue to work fine, I would at least create a new page template called “customized default” or something like that and leave page.php alone. Even so, putting all that code in 1 php would be pretty cumbersome if you have more than 1 or 2 pages to display. Also, if you ever have to change 1 item in one page then you have to change the one template, putting at risk all the other pages. I’m pretty good with CSS but the maze of DIVs gets me confused. I can’t imagine putting all the code for several pages into 1 php and keeping them straight.

    You would also have to come up with some way, probably a custom field, to uniquely identify each page so the php code could determine which page to display.

    So, while anything is possible with enough time and money, I would opt for the original approach.

  5. KJ says:

    Im not sure how to follow instructions given with the wordpress plugin WB EXAM. It says–>
    Create a PageTemplate that uses the tag

  6. Elahn says:

    How can I get this to work for WP 2.7.1?
    I’ve tried to make a new page called Archives and fiddled with Permalinks and PHP file editing but as a newbie of sorts I’m a little lost.
    Any step by step would be gratefully appreciated.

  7. Sophie says:

    I really wanted to know how do it, also you have another nice hacks.

  8. flowbee says:

    Hi,Thanks for sharing this nice post related this nice article of Creating a Custom Page Template.it is really nice..

  9. Rylie says:

    I can’t find a page template anywhere on my page. 🙁

  10. kapadokya says:

    How’s about custom template per category? I saw a post in the past and tried it. They have not been updated lately for WP 2.3, etc so write about it that would help us to customize more designs on categories to match its own theme.

  11. ex3m says:

    heyy all

    i need to say that is too simple

    just instal Page Links To >>>> http://txfx.net/wordpress-plugins/page-links-to/

    thnx

Trackbacks/Pingbacks »

  1. Elite By Design » Blog Archive » Saturday’s Sources 6 says:
  2. WordPress Weekly News, 15-2008: security and much more says:
  3. Wordpress Hacks, Guides and Tricks | TechnoBuzz.net says:
  4. Top 30 Most Wanted Wordpress Tricks and Hacks | Make Money Blogging Experiment says:
  5. 100+ Killer Wordpress Resources | Steffan Antonas' Blog says:
  6. Agregado Lifestream Theme for Wordpress Released | Darren Hoyt Dot Com says:
  7. RSS ” I Lv Blg “ » Agregado Lifestream Türkçe Wordpress Temas? says: