Template
Quick Definition
A template is a file in your WordPress theme that controls how a specific type of content is displayed. WordPress uses a template hierarchy to automatically pick the right template for each page.
What Is a Template?
A template is a modular, reusable file in your WordPress theme that generates a specific type of web page. According to the WordPress Theme Handbook, template files are PHP files (or HTML files in block themes) that WordPress uses to render different types of content.
Some templates appear on every page (like header and footer), while others only display under specific conditions — for example, single.php only loads when viewing a single blog post.
The Template Hierarchy
WordPress uses a template hierarchy to decide which template file to use for each page. It searches from most specific to least specific, using the first match.
For a post with slug "my-first-post", WordPress looks for:
single-post-my-first-post.phpsingle-post.phpsingle.phpsingular.phpindex.php(ultimate fallback)
Main template types:
front-page.php— homepagehome.php— blog listingsingle.php— individual postspage.php— static pagesarchive.php— archivessearch.php— search results404.php— error pageheader.php/footer.php— site-wide
Templates in Block Themes
In block themes, templates are HTML files in /templates/. Edit them visually in the Site Editor using blocks — no code required.
Why It Matters
Templates control your site's layout for different content types. See our best themes guide and theme selection guide.