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 format Example Usage
$custom featured-image-left Displays the featured image to the left
page-$slug page-template-hierarchy Template specifically for the template-hierarchy page
page-$id page-2 Template specifically for page ID 2
page Sitemap Default for the Page post type
singular n/a Fallback for pages
index Fallback 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