Creating and Editing Custom Templates

Browse manual On this page × Wordpress Manual WordPress Fundamentals Toggle WordPress Fundamentals section What Is WordPress? WordPress.org vs WordPress.com What Can You Build with WordPress? How WordPress Works WordPress Core, Themes, Plugins and Content Essential WordPress Terminology How to Plan a WordPress Website Domains, Hosting, DNS and HTTPS Explained How to Choose WordPress Hosting…

3 min read

  • Article
  • Intermediate
  • 3 minutes read
  • Reviewed August 3, 2026

A custom template provides an alternative reusable layout for selected content.

Examples include a full-width page, a landing page without the normal title, a documentation layout with a sidebar or a campaign page with a different header.

The implementation depends on whether the active theme is block-based or classic.

Custom Templates in Block Themes

Block themes can register templates through theme files and theme.json. Authorized users can also create or edit templates through the Site Editor or Template Editor.

A block template uses dynamic blocks such as Post Title and Post Content to display the current record. It can include template parts and patterns for reusable structure.

When a user edits a theme-supplied template, WordPress can store the customized version in the database. That version may override later file changes until it is reset.

Creating a Template in the Site Editor

A typical workflow is:

  1. Open Appearance → Editor.
  2. Open Templates.
  3. Add a new template or choose an existing one.
  4. Build the structure with blocks and template parts.
  5. Include the appropriate dynamic content blocks.
  6. Save the template.
  7. Assign it to supported content where required.
  8. Test several records, not only one example.

Interface labels can change between WordPress releases, but the underlying distinction between content and template remains.

Custom Templates in Classic Themes

Classic themes create custom page templates in PHP.

A file header identifies the template name and can optionally restrict the supported post types. The file then renders the structure using WordPress template functions.

Place vendor-theme customizations in a child theme rather than editing the parent directly.

Designing the Template Contract

Before creating a template, define:

  • Which content types may use it.
  • Which fields or blocks it expects.
  • Whether it includes a title and featured image.
  • Which global template parts it uses.
  • How wide and narrow content behave.
  • How it responds on small screens.
  • Whether editors can modify the structure.
  • What happens when optional content is missing.

A template should not require editors to remember undocumented layout tricks.

Avoiding Template Proliferation

Do not create a new template for every small variation.

Prefer:

  • Block styles for visual variants.
  • Patterns for reusable sections.
  • Template parts for shared regions.
  • Conditional code for small contextual changes.
  • A limited set of clearly named templates.

Too many templates make assignments inconsistent and increase testing work.

Updating Templates Safely

Treat templates as production code or governed configuration.

  • Test changes in staging.
  • Review every content type that uses the template.
  • Keep exports or version-controlled files.
  • Check database overrides.
  • Verify accessibility and responsive behavior.
  • Avoid deleting a template without migrating assigned content.
  • Document any plugin blocks required by the layout.

Frequently Asked Questions

Can I create a template without coding?

Yes, block themes and compatible themes allow template creation with blocks. Classic PHP templates require code.

Why does my new template not appear for a post type?

The template may not be registered for that content type, the theme may not support the relevant editor or permissions may restrict assignment.

What happens if I delete an assigned template?

Content normally remains, but WordPress will fall back to another available template and the layout can change.

Continue Learning

Previous: Query Loops and Dynamic Content

Next: Child Themes Explained