Wednesday 24 July 2013

How to Create a Template

To use a page template, you have to create one. You can create this file in a text-editor program, such as Notepad. (To see how to create a template, flip over to Book VI, which gives you extensive information on WordPress templates and themes.) To create an About page, for example, you can save the template with the name about.php.
When you have your template created, follow these steps to make it part of WordPress:

1. Upload the template file to your WordPress theme folder.
You can find that folder on your Web server in /wp-content/themes.
2. Log in to your WordPress Dashboard and click Editor in the
Appearance drop-down list.
The Edit Themes page opens.
3. Click the about.php template link located on the right side of the
page.
4. Type the Template Name tag directly above the get_header() tem-
plate tag.
The header tag looks like this: <?php get_header(); ?>.

If you’re creating an About Page, the code to create the Template Name looks like this:

<?php
/*
Template Name: About Page
/*
?>
5. Click the Update File button.
The file is saved, and the page refreshes. If you created an About Page template, the about.php template is now called About Page in the template list on the right side of the page.
Figure 6-1 shows the Page template and displays the code needed to define

0 comments:

Post a Comment