
Editorial illustration; the panels and labels are representative, not a live WordPress administration screen.
If you copy the same navigation and footer blocks into six different page templates, every minor update turns into a tedious search-and-replace across your theme. WordPress block themes solve that with template parts: isolated structural sections—headers, footers, sidebars, or comment blocks—that you define once and pull into any template.
The trick is knowing where template parts end and where patterns or regular post content begin. Treating every repeated block as a template part is the quickest way to accidentally push a single-page layout change across an entire live site.
Where template parts fit vs patterns and page content
Think in three layers:
- Templates define the full layout for a route (
single.html,archive.html,404.html). - Template parts hold the shared structural shell inside those templates, such as the site header or footer.
- Patterns (regular or synced) belong inside content areas—a pricing table, a newsletter signup box, or an office address block that editors drop into posts and pages.
A good rule of thumb: if an edit should reshape the outer frame across multiple templates, it belongs in a template part. If it is a promotional banner or callout that editors might want to tweak on one landing page without touching the rest of the site, use a regular pattern instead.
In the WordPress dashboard, block themes expose these under Appearance > Editor > Patterns > Template Parts. Editing the original part updates every template that references it, which is exactly why you want clear, role-based names like header-minimal or footer-main rather than promo-2026-footer.
Wiring parts in /parts and theme.json
In a block theme’s codebase, template parts live inside the /parts directory as HTML files containing block markup. Creating /parts/header.html does not automatically render it anywhere, though—a top-level template has to explicitly include it by slug:
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
<main class="wp-block-group">
<!-- wp:post-content {"layout":{"type":"constrained"}} /-->
</main>
<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->
Setting tagName to header or footer ensures the rendered wrapper outputs semantic HTML landmarks for screen readers rather than generic <div> tags.
You should also register your parts in theme.json so the Site Editor groups them under the right area (header, footer, or uncategorized) with human-readable labels:
{
"version": 3,
"templateParts": [
{
"name": "header",
"title": "Main Header",
"area": "header"
},
{
"name": "footer",
"title": "Main Footer",
"area": "footer"
}
]
}
Keep the name in theme.json, the filename in /parts/, and the slug in your template markup identical. Mismatched slugs are a common reason a custom part silently renders empty.
The database override trap in team deployments
Here is the behaviour that catches developers off guard when moving a block theme from local Git to staging or production. The moment someone opens the Site Editor on a live WordPress site and hits Save on a template part, WordPress writes that customized markup into the wp_posts table as a wp_template_part post type.
From that point onward, the database version overrides the HTML file in your theme. You can edit /parts/header.html in VS Code, push to Git, deploy to production, and wonder why nothing changed on the front end.
Before deploying theme-level template changes, check whether the database is holding an override using WP-CLI:
wp post list --post_type=wp_template_part --fields=ID,post_name,post_status,post_modified
If an administrator legitimately tweaked a header in the Site Editor, do not wipe it out blindly. Export or copy the updated markup back into your theme repository so Git remains the source of truth, or clearly document which parts are intentionally managed in the database by the editorial team.
Inspecting and testing before a global change
Because a template part sits across multiple page types, never verify an edit on the homepage alone. After modifying a header or footer, check a single post, an archive page, a search results page, and your 404 template—both on desktop and at a 375px mobile width. Watch out for duplicate navigation landmarks, collapsed mobile menus that fail to open, and spacing shifts where the header meets the main content container.
For related WordPress architecture and maintenance guides, see WordPress Multisite Architecture: When to Use a Network and What to Check Before Enabling It, How to Enable WordPress Multisite: A Step-by-Step Guide, and WordPress Site Health Is Useful—But It Is Not Your Whole Maintenance Plan.
Template parts work best when you keep them boring and structural. Decide early whether your theme files or the live Site Editor owns the markup, and you will avoid most of the surprises that come with global block edits.