WordPress Template Hierarchy Cheat Sheet

Home Page Templates

  • front-page.php: Used if you have set a static front page in WordPress settings.
  • home.php: Serves as the main blog page if no static front page is set. Falls back to index.php.

Error Page Template

  • 404.php: Displayed when a page is not found.

Search Results Template

  • search.php: Used for displaying search results.

Date Archive Template

  • date.php: Shows posts by a specific date (year, month, day).

Author Archive Templates

  • author-{nicename}.php: Custom template for a specific author.
  • author-{id}.php: Template for authors based on their ID.
  • author.php: Default template for all author archives.

Category Archive Templates

  • category-{slug}.php: Template for a specific category by its slug.
  • category-{id}.php: Template for categories by ID.
  • category.php: Default template for all category archives. Falls back to archive.php and index.php.

Tag Archive Templates

  • tag-{slug}.php: Template for a specific tag by its slug.
  • tag-{id}.php: Template for tags by ID.
  • tag.php: Default template for all tag archives.

Taxonomy Archive Templates

  • taxonomy-{taxonomy}-{term}.php: Template for a specific term within a taxonomy.
  • taxonomy-{taxonomy}.php: Template for a specific taxonomy.
  • taxonomy.php: Default for all taxonomy archives.

Post Type Archive Templates

  • archive-{posttype}.php: Template for custom post types.
  • archive.php: General archive template.

Single Post Type Templates

  • single-{posttype}.php: Template for a specific post type.
  • single.php: Default for all single posts.

Attachment Templates

  • {MIME_type}.php: Template based on MIME type (e.g., image.php).
  • attachment.php: Default template for attachments.

Page Templates

  • custom-template.php: Custom template specified for individual pages.
  • page-{slug}.php: Template for a page by its slug.
  • page-{id}.php: Template for pages by their ID.
  • page.php: Default template for pages.

Fallback Template

  • index.php: Used as the ultimate fallback if no other template is found.

Notes:

  • Custom Templates: You can create custom templates for individual pages, categories, authors, etc., providing more control and personalization.
  • Single Post and Taxonomies: Custom templates allow you to personalize individual post types or taxonomy displays.

Share on :

Social Share

Recent Post

© 2024 All rights reserved by Go1digital.com