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.
  • 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.
  • Attachment:
    • Template Name: attachment.php, image.php, video.php, etc.
    • Position: Used for attachment pages.
    • Purpose: Displays attachment pages for images, videos, etc.

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.
  • Tag:
    • Template Name: tag-{slug}.php, tag-{id}.php, tag.php
    • Position: Used for tag archive pages.
    • Purpose: Displays posts with a specific tag.
  • 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.

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.
  • Date:
    • Template Name: date.php
    • Position: Used for date-based archive pages.
    • Purpose: Displays posts from a specific date.
  • 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.
  • General Archive:
    • Template Name: archive.php
    • Position: Used for general archive pages.
    • Purpose: Fallback template for archive pages.

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:

  1. Front Page:

    • front-page.php
    • home.php
    • index.php
  2. Home Page:

    • home.php
    • index.php
  3. Single Post:

    • single-{post-type}.php
    • single.php
    • index.php
  4. Page:

    • page-{slug}.php
    • page-{id}.php
    • page.php
    • index.php
  5. Category:

    • category-{slug}.php
    • category-{id}.php
    • category.php
    • archive.php
    • index.php
  6. Tag:

    • tag-{slug}.php
    • tag-{id}.php
    • tag.php
    • archive.php
    • index.php
  7. Custom Taxonomy:

    • taxonomy-{taxonomy}-{term}.php
    • taxonomy-{taxonomy}.php
    • taxonomy.php
    • archive.php
    • index.php
  8. Author:

    • author-{nicename}.php
    • author-{id}.php
    • author.php
    • archive.php
    • index.php
  9. Date:

    • date.php
    • archive.php
    • index.php
  10. Post Type Archive:

    • archive-{post-type}.php
    • archive.php
    • index.php
  11. Search Results:

    • search.php
    • index.php
  12. 404 Error Page:

    • 404.php
    • index.php