Home  >  Article  >  Backend Development  >  Xin Xing briefly analyzes the calling mechanism of WordPress theme files

Xin Xing briefly analyzes the calling mechanism of WordPress theme files

WBOY
WBOYOriginal
2016-08-08 09:24:221126browse

The so-called calling mechanism of WordPress theme files is the hierarchical sequence of calls.

Home page template:

1. The home page template is usually index.php or home.php. When a visitor visits the site, WordPress will first check whether home.php exists in the theme directory. If it does not exist, it will call index. php.

2. Therefore, the order of calling the home page template 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 the page visited by the visitor is a category page, WordPress will first query whether category.php exists in the theme file. If it does not exist, it will continue to query archive.php. If archive.php does not exist, it will call index.php. .

2. The order of calling the category page templates is as follows:

category-{slug}.php -> category.php -> archive.php -> index.php

Search results Page:

1. The search results page usually uses search.php or index.php

2. The order of calling the search results page template is: search.php -> index.php

Since Define the classification page:

1. The custom classification page is taxonomy.php or archive.php or index.php

2. The order of calling the custom classification page template is as follows:

taxonomy- {slug}.php -> taxonomy.php -> archive.php -> index.php

Tag page:

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 -& gt ; Index.php

Single page:

single-{slug}.php -> page.php -> index.php

Attachment page:

attachment .php -> single.php -> index.php

404 page:

404.php -> index.php

Where {slug} is an alias, and {id} is Corresponding ID

The above introduces Xin Xing’s brief analysis of the calling mechanism of WordPress theme files, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Yii2 uses RBACNext article:Yii2 uses RBAC