Wordpress open-source blog topic development File structure

Source: Internet
Author: User
Tags php and

The following is the WordPress topic file hierarchy, which template file will be used when WordPress displays a specific page type? Only by understanding the following theme hierarchies can you know what files are required for your WordPress theme.
What is the following file hierarchy?

Take the home page as an example. The following two files are home. php and index. php. The WordPress program will search for these two files from your topic folder in sequence:

If you find home. php, use home. php as the blog homepage template, even if your topic folder contains index. php;
If home. php is not found, use index. php as the homepage template;
If neither home. php nor index. php can be found, your theme will not be identified by WordPress, which is equivalent to waste.

Home Page

Home. php
Index. php

Article page:

Single-{post_type}. php-if the article type is videos (video), WordPress will look for the single-videos.php (WordPress 3.0 and later)
Single. php
Index. php

Page

Custom template-create a page in the WordPress background. You can select a custom template on the right side of the page.
Page-{slug}. php-if the page name is news, WordPress will look for the page-news.php (WordPress 2.9 and later support)
Page-{id}. php-if the page ID is 6, WordPress will look up the page-6.php
Page. php
Index. php

Category

Category-{slug}. php-if the category is abbreviated to news, WordPress looks for the category-news.php (WordPress 2.9 and later support)
Category-{id}. php-if category ID is 6, WordPress looks for the category-6.php
Category. php
Archive. php
Index. php

Tag

Tag-{slug}. php-if the tag is abbreviated to sometag, WordPress looks for the tag-sometag.php
Tag-{id}. php-if the tag ID is 6, WordPress looks for the tag-6.php (supported by WordPress 2.9 and later)
Tag. php
Archive. php
Index. php

Author

Author-{nicename}. php-if the author's nickname is rami, WordPress will look for the author-rami.php (WordPress 3.0 and later support)
Author-{id}. php-if the author ID is 6, WordPress will look for the author-6.php (WordPress 3.0 and later support)
Author. php
Archive. php
Index. php

Date page

Date. php
Archive. php
Index. php

Search Results

Search. php
Index. php

404 (not found) page

404. php
Index. php

Attachment page

MIME_type.php-it can be any MIME type (image. php, video. php, audio. php, application. php, or others ).
Attachment. php
Single. php
Index. php

For more information, see WordPress official documentation: http://codex.wordpress.org/Template_Hierarchy

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.