Newbie’s Guide to WordPress Design Template Hierarchy (Cheat Sheet)

After our infographic on how WordPress works behind the scenes, numerous users asked us to cover how a WordPress style works behind the scenes.

In this article, we will describe the WordPress template hierarchy for beginners. This cheat sheet is very useful when customizing a template or developing a custom WordPress style

WordPress template hierarchy explained for beginners

Why Learn About WordPress Template Hierarchy?

All modern-day WordPress themes include templates, stylesheets, javascript, and images. Together these files manage how your site aims to the users.

Related: 9 things you must search for when selecting the perfect WordPress style for your website.

WordPress has a standard template hierarchy. This implies that templates with specific filenames affect particular areas on your website. It also informs you what design template name to use for a specific product.

A lot of contemporary WordPress themes come with design templates to show category, date, archives, single posts, custom pages, and more. As a user, you can create more templates by producing a kid theme

Having said that, let’s take a look at how this WordPress template hierarchy works behind the scenes.

Picturing WordPress Template Hierarchy (Cheat Sheet)

WordPress uses an easy to understand and significant pattern for template names. The visual cheat sheet below explains which template files are used to show various pages on a WordPress website.

Here is a breakdown of which WordPress design template submits to modify for various pages in a common WordPress website.

Which template files are used by web page?

Site front page

Out of the box, WordPress displays your post on the web page of your website. You can likewise set it to utilize a custom-made web page (likewise known as front page) by visiting Settings” Checking Out page in WordPress admin location.

1. front-page. php— If you are using a fixed front page, then WordPress will first search for this design template file and use it to display front page.

2. home.php — If you are utilizing static front page, and you do not have front-page. php design template in your theme, then WordPress will search for home.php design template. It is likewise utilized to show default post on homepage.

3. index.php— If front-page. php or home.php do not exist, then WordPress falls back to index.php template to display homepage. This template is the default fallback design template in WordPress to show any page.

Which template files are used by single post?

Single post page template

WordPress tries to find these files to show a single post.

1. single- post-type -. php— Utilize this design template to modify the display screen of a specific individual post in any post type For example, if post type is ‘review’ and the post slug is acme-phone, then WordPress would look for single-review-acme-phone. php

2. single- post-type. php— WordPress will then check if there is a design template to show this particular post type. For instance, if the post type is review, then WordPress would look for single-review. php

3. single.php— WordPress will then fall back to single.php

4. singular.php— This design template includes another fallback to show a single product from any post type.

5. index.php— Finally, as mentioned above, WordPress eventually falls back to index.php.

Which design template files are utilized by single page?

Static page template

WordPress pages are among the default post types. They enable you to create fixed pages in your site instead of posts. See our guide on the difference between posts vs pages

1. Customized Page Template— The page design template appointed to the page. See how to produce a custom-made page design template in WordPress.

2. page- slug. php— If the page slug is contact-us, WordPress will aim to use page-contact-us. php

3. page- id. php— If the page ID is 17, then WordPress will search for a template file named page-17 php

4. page.php— The template to display all static pages.

5. singular.php— This template is a default alternative to all single post type products.

6. index.php— The default fallback template.

Which design template files are used by classification archives?

Category archive template

WordPress uses these files to display category associated pages in WordPress.

1. classification-. php— This template is utilized to display classification archive page for a specific category. For instance, if classification slug is reviews, then WordPress will search for category-reviews. php template.

2. category- id. php— WordPress then searches for a template with category ID. For instance, if classification ID is 17, then WordPress will try to find classification-17 php

3. category.php— This is the default design template to show all category archive pages in WordPress.

4. archive.php— This is the default design template used by WordPress to display any archive pages.

5. index.php— The default fallback design template.

Which design template files are utilized by tag archives?

Tag archive template

WordPress utilizes these files to display tag archive pages.

1. tag-. php— If the tag’s slug is fruits, WordPress will try to find tag-fruits. php

2. tag- id. php— If the tag’s ID is 17, WordPress will search for tag-17 php template.

3. tag.php— The default design template for tag archives.

4. archive.php— The default design template for any achive page.

5. index.php— The default fallback template.

Which design template files are utilized by customized taxonomy archives?

Custom taxonomy archive

Classifications and tags are two default WordPress taxonomies. Users can also develop their own custom taxonomies too. Here is how WordPress searches for templates to show custom taxonomy pages.

1. taxonomy- taxonomy -. php— If you have a custom taxonomy called genre, and there is a term ‘thriller’, then WordPress will search for taxonomy-genre-thriller. php

2. taxonomy-. php— If the taxonomy were category, WordPress would look for taxonomy-genre. php

3. taxonomy.php— The default template to show any customized taxonomy archives.

4. archive.php— The default fallback for all archive pages in WordPress.

5. index.php— The default fallback template in WordPress.

Which design template files are utilized by customized post types?

Custom post type archive

Here is how WordPress searches for design templates to display custom-made post type archives.

1. archive- post_type. php— If you have a post type is review, WordPress will look for archive-review. php

2. archive.php— The default template to display all archive pages in WordPress.

3. index.php— The default fallback design template in WordPress.

Which design template files are utilized to display author archives?

Author archive

WordPress generates archive pages for each author on your WordPress site. Here is how it looks for author archive template.

1. author- nicename. php— If the author’s great name is matt, WordPress will look for author-matt. php.

2. author- id. php— If the author’s user ID is 6, then WordPress will search for author-6. php

3. author.php— The default design template used to display author archive pages in WordPress.

4. archive.php— The default template to show all archive pages in WordPress.

5. index.php— The default fallback design template in WordPress.

Which design template files are utilized to show date based archives?

Date based archive

WordPress likewise displays your posts on date based archive pages for months and years. Here is how it tries to find templates for these pages.

1. date.php— The default template for date based archives.

2. archive.php— The default template utilized to display author archive pages in WordPress.

3. index.php— The default fallback design template in WordPress.

Which design template files are utilized to display search pages?

Search result page

1. search.php— The default page to display search outcomes in WordPress.

2. searchform.php— The design template to display a search form in WordPress.

3. index.php— The default fallback design template in WordPress.

Which template files are utilized to display 404 mistake pages?

404 Error page

The 404 mistake page is shown when WordPress is unable to find the requested material. See our guide on how to enhance your 404 page design template

1.404 php— The default template to display screen 404 mistake page in WordPress.

2. index.php— The default fallback template in WordPress.

Which design template files are utilized to show accessory pages?

Attachment pages

1. MIME_type. php— Mime_type represents file type. For example, image.php, video.php, application.php.

2. attachment.php— The default design template to display attachment pages.

3. single-attachment. php— To display a single attachment.

4. single.php— The default design template to show single post type items.

5. index.php— The default fallback template in WordPress.

Which design template files are used to display embeds?

Embeds

Considering That WordPress 4.5, you can use design templates to render a post embedded into WordPress.

1. embed- post-type – post_format. php— WordPress will search for a post type and post format design template initially. For example, if you have a review with video, then WordPress will search for embed-review-video. php

2. embed-. php— If the post type is review, WordPress would look for embed-review. php

3. embed.php— The default fallback for all embeds.

We hope this tutorial helped you find out about the WordPress template hierarchy. You may also want to see our list of the best drag & drop WordPress page builders

If you liked this article, then please sign up for our YouTube Channel for WordPress video tutorials. You can also discover us on Twitter and Facebook

Comments are closed.