Setup & site building · Explainer
What Is a WordPress Template? Explained

Short answer
A WordPress template is a file or saved layout that controls how one type of page is displayed, such as single posts, pages, archives or the 404 page. A theme contains many templates, and WordPress picks the right one for each view using the template hierarchy.
Key takeaways
- A template controls the layout of one type of view; a theme is the full package.
- Block themes use HTML templates you can edit in the Site Editor.
- Classic themes use PHP template files edited in code.
- The template hierarchy decides which template WordPress uses, ending at index.
- People also say template for themes, patterns and builder layouts, so check the context.
What is a WordPress template?
A WordPress template is a file or saved layout that tells WordPress how to display a certain type of page, such as a single post, a page, an archive or the 404 page.
Your content lives in the database. The template decides where that content goes on screen, and what appears around it, such as the header, sidebar and footer.
Think of it like a cookie cutter. Every blog post goes through the same single post template, so they all share one layout while the words inside change.
The word template is also used loosely for other things, which causes confusion. We sort those out below, but in WordPress itself it has a clear technical meaning.
Templates are mostly PHP mixed with HTML, and the PHP manual is the official reference for the language behind classic theme files.
How is a template different from a theme?
A theme is the whole design package, while a template is one part of it that controls one type of view; a theme contains many templates.
A typical theme includes templates for the home page, single posts, pages, archives, search results and errors. It also includes styles, settings and sometimes patterns and functions.
| Term | What it is | Example |
|---|---|---|
| Theme | The full design package | Twenty Twenty-Five |
| Template | Layout for one type of view | Single Posts, Pages, 404 |
| Template part | Reusable piece inside templates | Header, Footer |
| Pattern | Pre-made group of blocks you insert | Hero section, pricing table |
| Page builder template | A saved design in a builder plugin | An Elementor landing page kit |
Our explainer on what a WordPress theme is covers the bigger package in detail.
What do templates look like in a block theme?
In a block theme, templates are HTML files made of blocks, and you can view and edit them visually in the Site Editor under Appearance > Editor > Templates.
Block themes store templates in a templates folder, with files such as index.html, single.html and page.html. Each file contains block markup rather than PHP.
When you edit a template in the Site Editor, WordPress saves your changed version in the database. The theme's original file stays untouched, so you can reset the template back to the theme's version at any time.
Template parts, such as the header and footer, live in a parts folder. You can edit them once and the change shows everywhere they are used.
The Site Editor documentation walks through these screens. For background, read what a block theme is.
What do templates look like in a classic theme?
In a classic theme, templates are PHP files such as single.php, page.php and archive.php, which mix HTML with PHP template tags that pull content from the database.
PHP is the programming language WordPress is written in. Classic templates use functions such as the_title() and the_content() inside a loop to print each post.
Classic templates usually load shared parts with functions like get_header() and get_footer(), which pull in header.php and footer.php.
You cannot edit classic templates visually. Changes mean editing files, ideally in a child theme so updates do not wipe your work. Our guide on what a child theme is explains why.
How does WordPress choose which template to use?
WordPress follows the template hierarchy, a set of rules that checks for the most specific template first and falls back to more general ones until it reaches index.
For a single blog post, WordPress looks for a template made for that exact post, then one for its post type, then single, then singular, and finally index. It uses the first match it finds.
Here is a simplified view:
| Page being viewed | Checked first | Falls back to |
|---|---|---|
| A blog post | single-post | single, singular, index |
| A page | page-{slug}, page-{id} | page, singular, index |
| A category archive | category-{slug} | category, archive, index |
| Search results | search | index |
| Missing page | 404 | index |
The official template hierarchy documentation has the full chart. The visual map at wphierarchy.com is handy if you prefer a diagram.
This is why every theme must have an index template. It is the last fallback for everything.
What is a custom page template?
A custom page template is an extra template you can pick for a specific page from the editor sidebar, such as a full-width layout or a landing page without a header.
In the block editor, open a page, look in the Page settings for the Template option, and choose from the list your theme offers. Block themes let you create new custom templates there too.
Classic themes define custom page templates with a comment at the top of a PHP file, such as Template Name: Full Width. The theme then lists it in the template dropdown.
Our step-by-step guide to creating a custom page template covers both methods.
What else do people mean by a WordPress template?
Outside the technical meaning, people often say template when they mean a whole theme, a pre-designed starter site, a block pattern or a page builder layout.
Marketplaces sell WordPress templates that are really complete themes. Page builders such as Elementor offer templates that are saved designs for a page or section. The block editor offers patterns, which are ready-made groups of blocks.
The difference matters when you follow instructions. If a tutorial says edit the template, it usually means the theme's template in the Site Editor or a PHP file. If a seller says install the template, they usually mean a theme or a builder import.
If you want ready-made sections rather than whole layouts, see our guide on using block patterns.
Do you need to create your own templates?
Most site owners never need to build templates from scratch, because themes include the common ones and the Site Editor lets you adjust them without code.
You might want your own templates when:
- A page needs a different layout, such as a sales page without navigation.
- A custom post type needs its own single or archive view.
- One category should look different from the rest of the blog.
- You are building a theme for yourself or a client.
When you are ready, our guide on creating a WordPress template shows the steps.
If you change your mind later, you can also remove a template from WordPress or reset it to the theme default.
What are common template mistakes to avoid?
The most common mistakes are editing a parent theme's files directly, deleting the index template, and forgetting that Site Editor changes override the theme file until you reset them.
A few tips keep things safe:
- Use a child theme before editing classic PHP templates.
- Back up first, especially before editing templates on a live site.
- Remember the database copy. If a theme update changes a template but your site looks the same, your saved Site Editor version is probably taking priority.
- Name custom templates clearly, so other editors know what each one is for.
Frequently asked questions
Is a WordPress template the same as a theme?
No. A theme is the complete design package, and templates are the individual layouts inside it, such as the single post or page template. In everyday speech many marketplaces call whole themes templates, which is why the two words get mixed up.
Where are WordPress templates stored?
Block theme templates are HTML files in the theme's templates folder, and edited versions are saved in the database. Classic theme templates are PHP files in the theme's main folder. You can see block templates under Appearance, then Editor, then Templates.
Can I change a template without coding?
Yes, if you use a block theme. The Site Editor lets you edit templates and template parts visually with blocks. Classic themes need file edits or a page builder, though the Customizer offers some layout options in many themes.
What happens to my template edits when the theme updates?
In a block theme, templates you changed in the Site Editor are stored in the database, so updates do not overwrite them. In a classic theme, direct edits to theme files are lost on update unless you made them in a child theme.
Can different pages use different templates?
Yes. Each page can use the default page template or any custom template your theme provides. You choose it in the page settings sidebar of the block editor, under the Template option.
Sources
- Template Hierarchy WordPress Developer Resources
- Site Editor WordPress.org
- WordPress Template Hierarchy wphierarchy.com
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


