- 1). Open up Notepad and type in the following code at the top:
<?php
/**
* Template Name: My Own Template
*/
?>
This code specifies the name of your template. It's also the same name in the drop-down box of the "Page Attributes" field when selecting a template for your WordPress page. - 2). Add the following code to include the Header: <?php get_header(); ?>.
- 3). Type in the code to display content. This is the part where you can specify the layout for your page and what content to display. Use "<div>" tags to manipulate the layout using CSS code. For example, the standard one-page layout code for a WordPress page looks like this:
<div>
<div role="main">
<?php
get_template_part( 'loop', 'page' );
?>
</div><!-- #content -->
</div><!-- #container -->
The PHP function "get_template_part()" automatically displays content you enter for a particular page using the WordPress content editor. - 4). Add the following code to include your footer: <?php get_footer(); ?>.
- 5). Save the document as a PHP file.
- 6). Upload the file to your specific theme folder. For example, if you're using the Twenty-Ten theme, upload your template at "wp-content/themes/Twenty-Ten."
previous post