Thursday, 11 March 2010

How to: Create and use WordPress page templates


Page templates are very useful: They allow you to creates custom pages, for exemple creating an archive page which will list all your posts, or a page to display infos about the author.
A page template is defined by the following code, inserted on the firsts lines of the file:


<?php
/*
Template Name: Archives
*/
?>

Here, we just created a page template, named "Archives".


To use it on your theme, write a page, and scroll down until you see a "Page Template" dropdown list, as described in the picture below:


Create and use WordPress page templates


Then you just have to choose which page template to use, and save the page.


No comments:

Post a Comment