- Guide
- Intermediate
- 5 minutes read
- Reviewed August 5, 2026
- WordPress themes and templates
Templates define the document structure WordPress uses to display a request. Template parts represent smaller reusable regions that can be included in more than one template.
Together, they allow a theme to apply consistent layouts without rebuilding every page individually.
What a Template Controls
A template determines which elements appear and how they are arranged.
A single-post template might include:
- Site header.
- Post title.
- Author and date.
- Featured image.
- Post content.
- Taxonomy terms.
- Comments.
- Related content.
- Site footer.
The post supplies the stored values. The template supplies the reusable structure around them.
Templates in Classic Themes
Classic themes use PHP template files.
Common examples include:
index.php.home.php.front-page.php.single.php.page.php.archive.php.search.php.404.php.
Template functions retrieve content and include shared files such as header.php, footer.php or sidebar.php.
Templates in Block Themes
Block themes use HTML files containing block markup, usually inside a templates directory.
Instead of hard-coding the current post title in PHP, a template includes a Post Title block. A Post Content block outputs the body of the current item, while Query Loop can display collections.
Users with appropriate access can edit these templates in the Site Editor. User customizations may be stored in the database and take precedence over theme files.
What Template Parts Are
Template parts are reusable structural sections included by templates.
Typical examples are:
- Header.
- Footer.
- Sidebar.
- Comment area.
- Promotional strip.
- Repeated archive header.
In block themes, template parts are block-based and often managed in the Patterns area of the Site Editor. In classic themes, shared PHP files serve a similar reusable role, even though the implementation differs.
Templates vs Page Content
Do not place unique page content in a template unless every page using that template should display it.
Use a template for structure and dynamic placeholders. Use the post or page editor for the unique information belonging to one content item.
A common mistake is placing a specific heading or call to action directly in the Page template and then wondering why it appears everywhere.
Templates vs Patterns
Templates define complete page structures. Patterns are reusable groups of blocks that can be inserted inside content or templates.
A template can contain one or more patterns. A pattern does not become the routing template merely because it fills a large part of the page.
User-Created Templates
WordPress can allow administrators to create custom templates through the Site Editor or Template Editor.
These templates are useful for alternative layouts such as:
- Landing page without a title.
- Full-width page.
- Content with a sidebar.
- Special campaign layout.
Plan names and ownership carefully. A large collection of nearly identical templates becomes difficult to maintain.
Template Maintenance
- Keep template responsibilities clear.
- Reuse template parts for repeated regions.
- Avoid embedding unique content globally.
- Test every primary content type and archive.
- Document database customizations that override files.
- Review templates after theme updates.
- Maintain fallback behavior for content without a specialized template.
Frequently Asked Questions
Is a template the same as a page?
No. A page is a content record. A template is the reusable structure used to present that page and potentially many others.
Can several pages use one template?
Yes. That is one of the main purposes of templates.
Why does changing a theme file not update the site?
A user-edited template stored in the database may override the file. Caching can also delay visible changes.
Applying WordPress Templates and Template Parts in a Real WordPress Project
Separate content, presentation and permanent functionality. Test the editing workflow as well as the public output, because a theme decision affects templates, design controls, accessibility, performance and future redesign work.
A connected concept is Creating and Editing Custom Templates. Reading the two together helps separate the immediate task from the wider WordPress responsibility.
A useful implementation begins by writing down the current state, the intended outcome and the evidence that will prove the change worked. This prevents a configuration screen, plugin recommendation or code snippet from becoming the entire strategy.
A Practical Example
Imagine a team making this decision for a production WordPress site. The useful question is not only “Can WordPress do this?” but “Which layer owns it, who maintains it, what data does it affect and how will we verify it after an update?”
Write the answer in operational terms. Name the content, user, setting, file, API or service involved. Then identify what should remain true if the theme changes, a plugin is replaced or the site is migrated.
Questions to Ask
- What user or system problem does this solve?
- Which WordPress layer owns the behaviour?
- What data is created or changed?
- Who may perform the action?
- What can fail, and how will that failure be visible?
- How is the result tested after updates?
- What is the migration or removal path?
Official Reference Context
The Theme Handbook is the primary version-specific reference for this topic. Use the current documentation to verify interface labels, supported APIs and behaviour before applying instructions to a production site.
How to Verify the Result
- Test representative templates on mobile and desktop.
- Check keyboard navigation, headings, contrast and focus.
- Switch editing contexts and confirm that the team knows where each design decision is stored.
Related Articles
- Creating and Editing Custom Templates
- Template Hierarchy for Custom Content
- Block Editor vs Site Editor
- The WordPress Template Hierarchy
Sources and Further Reading
- Theme Handbook
- WordPress 7.0 Field Guide
- Block Editor Handbook
- WordPress Accessibility Coding Standards
Continue Learning
- Section: Themes and Templates
- Previous: Navigation in WordPress
- Next: The WordPress Template Hierarchy