Home > Web Administration, WordPress > WordPress – Create you own Page Template

WordPress – Create you own Page Template

Here is a method if you want to be able to create your own page templates and have them available to choose from when you create a new page.

Assumptions: You have shell access and are in a Linux environment.

Typically one is happy with the default page template but would like to make a modification. Lets start with the default page template, copy it to a new file name and then edit it to be a new page template.

First make a copy of the default page template renaming it. In my case I’m using the Inove theme and they have separated their templates into a subdirectory called “templates”. So we have to touch two files to keep in line with this themes format.

# cd <your wordpress directory>/wp-content/themes/inove

# cp page.php page.custom.php

# vi page.custom.php

Edit the file to look like this:

<?php
/*
Template Name: Page by Category
*/
?>
<?php get_header(); ?>
<?php include(‘templates/page.custom.php’); ?>
<?php get_footer(); ?>

# cd <your wordpress directory>/wp-content/themes/inove/templates

# cp page.php page.category.php

Now make your modifications to page.custom.php under the templates directory and the next time you add a page it will be available to you as a page template.

Categories: Web Administration, WordPress Tags:
  1. No comments yet.
  1. No trackbacks yet.