: This article mainly introduces the calling mechanism of the WordPress theme file by Xin Xing. if you are interested in the PHP Tutorial, refer to it. The so-called WordPress topic file calling mechanism is the hierarchical relationship of calls.
Homepage template:
1. the homepage template is usually index. php or home. php. when a visitor accesses the site, WordPress first queries whether home. php exists in the topic directory. if not, index. php is called.
2. the order of homepage template calls is as follows: home. php-> index. php
Category page Template:
1. the category page template is usually category. php or archive. php or index. php: When a visitor accesses a page of classification, WordPress first queries whether category exists in the topic file. php. if it does not exist, query archive. php, if archive. if php does not exist, index is called. php.
2. the order of template calls on the classification page is as follows:
Category-{slug}. php-> category. php-> archive. php-> index. php
Search result page:
1. search result pages usually use search. php or index. php
2. the order of template calls on the search result page is: search. php-> index. php
Custom category page:
1. the custom classification page is taxonomy. php, archive. php, or index. php.
2. the order of template calls on the custom classification page is as follows:
Taxonomy-{slug}. php-> taxonomy. php-> archive. php-> index. php
TAB:
Tag-{slug}. php-> tag. php-> archive. php-> index. php
Author Archive page:
Author-{id}. php-> author. php-> archive. php-> index. php
Time Archive page:
Date. php-> archive. php-> index. php
Article content page:
Single-{id}. php-> single. php-> index. php
Separate page:
Single-{slug}. php-> page. php-> index. php
Attachment page:
Attachment. php-> single. php-> index. php
Page 404:
404. php-> index. php
{Slug} is the alias, and {id} is the corresponding ID.
The above introduces the calling mechanism of the WordPress theme file by Xin Xing, including some content, and hopes to help those who are interested in the PHP Tutorial.