Bob's Blog about WordPress, Websites, Hosting, Computers and the Internet

Making a Page Template

Template ChoicesFirst, look in your theme folder for a file named page.php – make a copy of it and rename it an appropriate name – we’ll use page-without-sidebar.php for this example.

Next, open the new file (page-without-sidebar.php) and copy and paste this into your file at the very top (change the name ‘page without sidebar’ in the code to the name of your choice – this is the actual name of the template that will be listed when selecting the template from within the Write/Manage Page editor.    

<?php
/*

Template Name: Page without sidebar

*/
?>

Now when you go to save a page you should see this as a page template choice.  You can make your code changes to this file and then use it to display pages of your choice.  A simple example is you could paste code for an advertisement before your post content.  Then pages you publish using this template would have the ad included.


Related Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>