Blog
WordPress all template files name with position and purpose
1. Front Page
- Template Name:
front-page.php - Position: Highest priority for the front page.
- Purpose: Displays the site's front page, either a static page or the latest posts.
2. Home Page (Blog Posts Index)
- Template Name:
home.php - Position: Used if the front page is set to display the latest posts or if a separate posts page is set.
- Purpose: Displays the blog posts index.
3. Singular Templates
- Single Post:
- Template Name:
single-{post-type}.php,single.php - Position: Used for single post pages.
- Purpose: Displays individual posts of a specific post type or the default single post template.
- Template Name:
- Page:
- Template Name:
page-{slug}.php,page-{id}.php,page.php - Position: Used for individual static pages.
- Purpose: Displays individual static pages with a specific slug, ID, or the default page template.
- Template Name:
- Attachment:
- Template Name:
attachment.php,image.php,video.php, etc. - Position: Used for attachment pages.
- Purpose: Displays attachment pages for images, videos, etc.
- Template Name:
4. Custom Post Type
- Template Name:
single-{post-type}.php - Position: Used for single posts of a custom post type.
- Purpose: Displays single posts of a specific custom post type.
5. Taxonomy Templates
- Category:
- Template Name:
category-{slug}.php,category-{id}.php,category.php - Position: Used for category archive pages.
- Purpose: Displays posts in a specific category.
- Template Name:
- Tag:
- Template Name:
tag-{slug}.php,tag-{id}.php,tag.php - Position: Used for tag archive pages.
- Purpose: Displays posts with a specific tag.
- Template Name:
- Custom Taxonomy:
- Template Name:
taxonomy-{taxonomy}-{term}.php,taxonomy-{taxonomy}.php,taxonomy.php - Position: Used for custom taxonomy archive pages.
- Purpose: Displays posts in a specific custom taxonomy term.
- Template Name:
6. Archive Templates
- Author:
- Template Name:
author-{nicename}.php,author-{id}.php,author.php - Position: Used for author archive pages.
- Purpose: Displays posts by a specific author.
- Template Name:
- Date:
- Template Name:
date.php - Position: Used for date-based archive pages.
- Purpose: Displays posts from a specific date.
- Template Name:
- Post Type Archive:
- Template Name:
archive-{post-type}.php,archive.php - Position: Used for post type archive pages.
- Purpose: Displays archive pages for custom post types.
- Template Name:
- General Archive:
- Template Name:
archive.php - Position: Used for general archive pages.
- Purpose: Fallback template for archive pages.
- Template Name:
7. Search Results
- Template Name:
search.php - Position: Used for search results pages.
- Purpose: Displays search results.
8. 404 Error Page
- Template Name:
404.php - Position: Used for 404 error pages.
- Purpose: Displays a 404 Not Found page when a page is not found.
9. Default Template
- Template Name:
index.php - Position: Fallback template for all pages.
- Purpose: Default template used if no other template matches.
Template Hierarchy Overview
Here's a visual representation of the WordPress template hierarchy:
Front Page:
front-page.phphome.phpindex.php
Home Page:
home.phpindex.php
Single Post:
single-{post-type}.phpsingle.phpindex.php
Page:
page-{slug}.phppage-{id}.phppage.phpindex.php
Category:
category-{slug}.phpcategory-{id}.phpcategory.phparchive.phpindex.php
Tag:
tag-{slug}.phptag-{id}.phptag.phparchive.phpindex.php
Custom Taxonomy:
taxonomy-{taxonomy}-{term}.phptaxonomy-{taxonomy}.phptaxonomy.phparchive.phpindex.php
Author:
author-{nicename}.phpauthor-{id}.phpauthor.phparchive.phpindex.php
Date:
date.phparchive.phpindex.php
Post Type Archive:
archive-{post-type}.phparchive.phpindex.php
Search Results:
search.phpindex.php
404 Error Page:
404.phpindex.php


