Иерархия шаблонов темы WordPress

Схема

Например, archive-$posttype.php == category.php (также см. ниже рисунка)

Home Page display - главная страница

home.php или index.php

Front Page display

front-page.php - Used for both Your latest posts or A static page as set in the Front page displays section of Settings -> Reading
Page display rules - When Front page is set in the Front page displays section of Settings -> Reading
Home Page display rules - When Posts page is set in the Front page displays section of Settings -> Reading

Single Post display

single-{post_type}.php - If the post type were product, WordPress would look for single-product.php.
single.php
index.php

Page display

custom template file - The Page Template assigned to the Page. See get_page_templates().
page-{slug}.php - If the page slug is recent-news, WordPress will look to use page-recent-news.php
page-{id}.php - If the page ID is 6, WordPress will look to use page-6.php
page.php
index.php

Category display

category-{slug}.php - If the category's slug were news, WordPress would look for category-news.php
category-{id}.php - If the category's ID were 6, WordPress would look for category-6.php
category.php
archive.php
index.php

Tag display

tag-{slug}.php - If the tag's slug were sometag, WordPress would look for tag-sometag.php
tag-{id}.php - If the tag's ID were 6, WordPress would look for tag-6.php
tag.php
archive.php
index.php

Custom Taxonomies display

taxonomy-{taxonomy}-{slug}.php - If the taxonomy were sometax, and taxonomy's slug were someterm WordPress would look for taxonomy-sometax-someterm.php. In the case of Post Formats, the taxonomy is 'post_format' and the terms are 'post-format-{format}. i.e. taxonomy-post_format-post-format-link.php
taxonomy-{taxonomy}.php - If the taxonomy were sometax, WordPress would look for taxonomy-sometax.php
taxonomy.php
archive.php
index.php

Custom Post Types display

archive-{post_type}.php - If the post type were product, WordPress would look for archive-product.php.
archive.php
index.php
(when displaying a single custom post type see the Single Post display section above.)

Author display

author-{nicename}.php - If the author's nice name were rami, WordPress would look for author-rami.php.
author-{id}.php - If the author's ID were 6, WordPress would look for author-6.php.
author.php
archive.php
index.php

Search Result display

search.php
index.php

404 (Not Found) display

404.php
index.php

Attachment display

MIME_type.php - it can be any MIME type (image.php, video.php, application.php). For text/plain, in order:
text.php
plain.php
text_plain.php
attachment.php
single-attachment.php
single.php
index.php

...

Источник

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *