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