60Web60

Understanding WordPress Template Hierarchy

WordPress Help4 min read·

This article explains how WordPress template hierarchy works and how it affects your website's appearance.

What is WordPress Template Hierarchy

WordPress template hierarchy is the system that determines which template file displays your content. When someone visits a page on your website, WordPress follows a specific order to decide which template file to use.

Think of it like a filing system. WordPress looks for the most specific template first, then falls back to more general templates if the specific one doesn't exist.

How Template Hierarchy Works

WordPress follows this order when choosing templates:

  1. Most specific template - For example, a template for one specific page
  2. Category-specific templates - Templates for specific types of content
  3. General templates - Basic templates that work for any content
  4. Index template - The default fallback template

For a homepage, WordPress looks for templates in this order:

  • front-page.php (most specific)
  • home.php
  • index.php (fallback)

For individual pages, the order is:

  • page-[slug].php (page with specific name)
  • page-[ID].php (page with specific ID number)
  • page.php (general page template)
  • index.php (fallback)

Common Template Files and Their Purpose

index.php - The main fallback template that displays if no other template exists

home.php - Controls your blog posts page

front-page.php - Controls your static homepage

page.php - Template for individual pages you create

single.php - Template for individual blog posts

archive.php - Template for category and tag pages

404.php - Template shown when pages aren't found

Why This Matters for Your Website

Understanding template hierarchy helps when:

  • Your pages look different than expected
  • You want to customise how specific pages appear
  • You're troubleshooting display issues
  • You're working with a developer to make changes

Most Web60 themes handle template hierarchy automatically. However, if you're experiencing display issues, the problem might be a missing or incorrect template file.

Troubleshooting Template Issues

If pages on your website don't look right:

  1. Check if you're using the correct page template in your WordPress admin
  2. Verify your theme includes the necessary template files
  3. Clear any caching if you've made recent changes
  4. Check if a plugin might be interfering with template selection

For theme-related issues, you might need to look at how to install WordPress themes or consider understanding WordPress child themes if you plan to make customisations.

If you're still stuck with template hierarchy issues, contact Web60 support through your dashboard. Include details about which pages look incorrect and what you expected them to show.

FAQ

Q: Can I create my own template files?

A: Yes, if you're using a child theme. Never edit template files directly in your main theme as updates will overwrite your changes.

Q: Why does my homepage look different from other pages?

A: WordPress uses different template files for homepages (front-page.php or home.php) versus regular pages (page.php), which can have different designs.

Q: What happens if I delete a template file?

A: WordPress will use the next template in the hierarchy. If you delete page.php, it will use index.php instead.

Q: How do I know which template file is being used?

A: You can install a plugin that shows the current template, or ask a developer to help identify which template is loading.

Q: Can different pages use completely different layouts?

A: Yes, you can assign different page templates to different pages through the WordPress admin, or your theme might include multiple template options.

Q: Why don't my blog posts look the same as my pages?

A: Blog posts use single.php template while pages use page.php template. These files often have different styling and layouts.

Last updated: 1 March 2026