When creating a new page in Wordpress, we usually have a choice for the page template. It's call Default template. However, we sometimes need to make a new page with a new appearance. Then another page template is needed. Instead of downloading a shared page template from internet, we can create a new page template by below instructions.
[caption id="attachment_504" align="alignnone" width="289"] Only have default template[/caption]
- Create template file:
- Go to your website file manager and open your current theme directory: /wp-content/themes/your_current_theme_name/
- Create a new file like your_new_template.php contains below codes with Your new template is your new template name:
Template Name: Your new template
- Before building contents for new template, you should know the template tags. They will be used to display your template contents dynamically. Some common template tags are:
- get_header(): display header part by including header.php file from your current theme directory;
- the_content(): display the contents of current page;
- get_sidebar(): display siderbar part by including sidebar.php file from your current theme directory;
- get_footer(): display footer part by including footer.php file from your current theme directory;
- And more tags at Wordpress Codex.
- Coding template contents: using the template tags, we can simply build the template contents. We have an example for full width layout template here.
[html]<php get_header(); ?>
<div id="content" class="content">
<?php the_content(); ?>
<?php get_footer(); ?>[/html]
[caption id="attachment_505" align="alignnone" width="288"] Have option to choose another template[/caption]