Sinsing analysis on the calling mechanism of WordPress theme files

Source: Internet
Author: User

The so-called WordPress theme file invocation mechanism, that is, the hierarchy of the call relationship.


Homepage Template:

1. The home page template is usually index.php or home.php, when the visitor visits the site, WordPress will first query the subject directory for the existence of home.php, if not present, call index.php.

2. So the order of the first page template call 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 visitor visited the page as a category page, WordPress first queries the theme file for the existence of category.php, if not exist then continue to query archive.php, if Archive.php also does not exist then call index.php.

2. The Order of Classification page template calls is as follows:

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


Search Results page:

1. Search results pages typically use search.php or index.php

2. The order of Search results page template calls is: search.php, index.php


Custom Category page:

1. Custom Classification page decibel is taxonomy.php or archive.php or index.php

2. The order of the Custom category page template calls is as follows:

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


tab page:

index.php, archive.php, tag-{slug}.php, tag.php,


Author Archive page:

index.php, archive.php, author-{id}.php, author.php,


Time Archive page:

date.php, archive.php, index.php


Article content page:

single-{id}.php, single.php, index.php

Individual pages:

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


Attachments page:

attachment.php, single.php, index.php


404 page:

404.php-index.php


where {slug} is an alias, and {ID} is the corresponding ID

Sinsing analysis on the calling mechanism of WordPress theme files

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.