Skip to main content

Create Wordpress page template

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"]Wordpress page template 1 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">
<div class="post">
<div class="entrytext">
<?php the_content(); ?>
<?php get_footer(); ?>[/html]

That's all. After creating new template, you can now use it for new appearance page.

[caption id="attachment_505" align="alignnone" width="288"]Wordpress page template 2 Have option to choose another template[/caption]

Wish succeed!


  1. می‌گه: :چجوری باید تعداد برترین مطالب رو زیاد کنم ۳ تا فقط میاره !کد زیر رو در فایل lsidebar.php پیدا کنید و به جای ۱۵ هر عددی که خواستید بذارید$result = $wpdb->get_results( SELECTconemmt_count,ID,post_title FROM $wpdb->posts ORDER BY conemmt_countDESC LIMIT 0 , 15 );


Post a Comment

Popular posts from this blog

Turn off AutoPlay on Windows

On Windows, when you insert an USB or a CD/DVD into your computer, they are usually opened automatically. So the computer maybe infected autorun virus. To avoid that, you should turn off AutoPlay function.

Integrate blogspot blogger blog with Dot TK free domain

Blogspot or Blogger is a blog service from Google. This service provides us many functions to make a small website as creating a blog, posting, commenting, . . . But there is a thing which might cause you dissatisfy. That's the blog address is too long, like . If you own a short Dot TK domain , then your problems will be solved.