Saturday, September 1, 2012

How To Create A Custom Page Template In WordPress

To create a WordPress Page Template, you’ll need to use your text editor. Go to the directory on your server where you installed WordPress, and then navigate to the directory of your theme. Usually that looks something like this: “/wp-content/themes/default” where “default” is your theme name.

That’s where you will create your custom page template file. Create a file called “cover_page.php” and add the following code to it:
<?php /* Template Name: Cover Page */ ?>
<?php get_header(); ?>
Here's my cover page!
<?php get_footer(); ?>


<?php if (is_page_template('cover_page.php') ) 
{ ?>    <p>Apples</p>    <?php } 
else { ?>    <p>Oranges</p>    <?php } ?>

No comments:

Post a Comment