single-post.html
header

What does Create a custom template do?

Question: When I chose New from the Template panel in the Post settings I saw a Create a custom template dialog. What’s a Custom template and what does it contain as default?

Answer: A custom template is one that overrides the default template for the selected post, page or query.

The Create a custom template dialog creates a new template in the database.

WordPress supports a variety of Custom templates. Some of them were originally created to be unique to a particular page, others could be assigned depending on the post type. Full Site Editing allows you to choose the template to be assigned to a particular post. How you use/misuse this freedom is up to you.

Page template hierarchy

Template name formatExampleUsage
$customfeatured-image-leftDisplays the featured image to the left
page-$slugpage-template-hierarchyTemplate specifically for the template-hierarchy page
page-$idpage-2Template specifically for page ID 2
pageSitemapDefault for the Page post type
singularn/aFallback for pages
indexFallback for everything
Custom page template hierarchy

References

See Template hierarchy for the full hierarchy.

Template editor

Additional note from Ann McCarthy

If you switch themes, these custom templates are lost and it would be good to highlight that: https://github.com/WordPress/gutenberg/issues/31954

© Copyright Herb Miller, Bobbing Wide 2021