Custom templates may be defined for single posts, pages or custom post types ( CPTs ).
They override the template hierarchy.
Custom templates may need to be defined in theme.json
Template name format | Example & template name | Usage |
---|---|---|
$custom | featured-image-left | Displays the featured image to the left of the post content. Used when the featured image is a narrow portrait image. |
$custom | output-input | Debugging template parts or content |
page-$slug | page-template-hierarchy | Template specifically for the template-hierarchy page |
page-$id | page-2 | Template specifically for post ID 2 – initially the sample-page |
page | This page | |
singular | Used if single / page is not found | |
index | Default template |
See Template hierarchy for the full hierarchy.