Create a new page template in wordpress

Creating a new page template inside your wordpress theme is very easy.

Just go inside your theme’s folder (you’ll need FTP access to do this), and copy the file  page.php.  The path to this file should be something like:

/wp-content/themes/mytheme/page.php

Rename the copy to something representative, depending on the template you’re creating.  Something like page-mytemplate or page-flickr.php (ex. if you want to show some flickr photos) and save it in the same root.

Then open it and add this to the top of your new .php file:

/*
* Template Name: My Page Template
*/

This code will help wordpress identify your template and the name you put here will show on the “Page Attributes” box inside the page editor.

Then, you can go and create your new page.  Inside the “Page Attributes” box at the right of the editor, you’ll find a drop-down named “Template” where you’ll find your new template.

Just choose your template and the page will display whatever is inside the page-mytemplate.php.

This is a very powerful way of having wordpress do almost whatever you want and it’s specially useful when you’re not running a blog, but a company webpage .  In fact, there are some pages that are just using one powerful, well-done, php template for showcasing different products or services.

So go ahead and give it a try…

 

 

Leave a Reply