You can create a separate homepage template for the eighth class WordPress theme Tutorial

Source: Internet
Author: User

Yesterday the use of the Firefox firebug plug-in share, we see the trust will use. Today, we'll create a template for the theme.

When we just started to install the WordPress system to enable a theme, the default home page is displayed in the list of articles, that is, the form of the blog, then it first call is the theme inside index.php this file. While we are looking at the more functional topics, they basically have a homepage template. With the template you can define some of your own content, and not affected by other files, those who do the single page template is the case, of course, according to their own needs to add. We can create a PHP file in the theme file, such as: page-home.php or front-page.php, and then open the file at the top of the file need to write the name of the template, as follows:

1 <?php
2 /**
3
4 Template Name: Home template(这个名称根据自己的需要来命名)
5
6 **/
7 ?>

After the file is saved we can see the name of the template you added in the WordPress background page and then click Quick Edit, such as:

650) this.width=650; "class=" AlignCenter size-full wp-image-672 "title=" home-page-template "src="/http Www.favortt.com/wp-content/uploads/2011/11/home-page-template.jpg "height=" "width=" 224 "/> After selection is also required in the background settings- > Read there to select a static page, and then on the home page where you select the template that you added,

650) this.width=650; "class=" AlignCenter size-full wp-image-673 "title=" Home-select-page "src="/http Www.favortt.com/wp-content/uploads/2011/11/home-select-page.jpg "height=" "width=" 245 "/>

This way, your homepage can be customized by yourself.

Another method is also lei son more commonly used, is to create a home.php file, WordPress will read home.php this file first. If you have created the home.php file, you have also selected a home page template in the background. Then WordPress will first execute the selected template page, this need to remind everyone. And if you've selected the home page after reading settings in the background. We write function judgment is not the first page when the method is Is_front_page (), if you are creating a home.php file, then we judge the home page is Is_home (), this is a difference. This solves why some friends say that using the is_home () to judge the homepage but no effect of the reasons, in fact, you chose the first method of the reason.

This allows you to customize your homepage with the template we created, and try it out!

All rights reserved: Wuhan can be treated Technology Co., Ltd. http://www.kissneck.com

You can create a separate homepage template for the eighth class WordPress theme Tutorial

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.