If your theme supports post formats, you might want your video posts (or galleries, or quotes) to look different from normal posts. The old version of this post showed two ways to do that: load a different content part for each format, or load a whole different template file with a template_include snippet.
I tested both on WordPress 7.1.5. They still run without a single notice, but the second one has three problems: it ignores a template you pick for a post, its file names clash with WordPress’s own, and it does nothing in a block theme. So in this guide, I will show you the method I’d use today, which works in classic and block themes, plus the ways to do it without code.
The short answer
- To change only the post content per format,
get_template_part( 'content', get_post_format() )insingle.phpstill works as it is. - For a whole template per format, add
single-format-{format}.phpto WordPress’s template list with thesingle_template_hierarchyfilter. In a block theme, the same filter loads a block template namedsingle-format-video. - For one post only, pick a template in the editor. No code needed.
- For a list of all video posts, WordPress already has
/type/video/, and the Query Loop block has a Formats filter.
What I tested
I ran WordPress 7.1.5 (PHP 8.5) in WordPress Playground with debug mode on, with three themes: a small classic theme I wrote for the test, a child theme of it, and a child theme of Twenty Twenty-Five, which supports all nine post formats. Every template printed its own name on the page, so I could see exactly which file WordPress used. These are the results for a video post:
| Method | Classic theme | Block theme |
|---|---|---|
| No code | single.php (with content-video.php if it exists) | Single Posts |
2014 template_include snippet | single-video.php, but a template picked for the post is ignored | No effect |
single_template_hierarchy filter | single-format-video.php, a picked template still wins | single-format-video template |
1. Add post format support to your theme
Post formats only show up in the editor if your theme asks for them. Many themes do already, Twenty Twenty-Five included. If yours doesn’t, add this to your (child) theme’s functions.php and keep only the formats you need:
add_action( 'after_setup_theme', 'tp_post_formats_support' );
function tp_post_formats_support() {
add_theme_support( 'post-formats', array( 'aside', 'gallery', 'video', 'audio', 'quote' ) );
}Code language: PHP (php)
In the block editor, you’ll find it in the Post tab of the sidebar, as a “Format” row under Template and Discussion. Click it to choose a format. It should look like this:

One thing I didn’t expect: when I removed the theme support again, the Format row disappeared, but the post kept its format. It stayed “video” even after I edited and saved the post, and the video template, the format-video CSS class and the format archive all kept working. So formats you set with an old theme still affect your site after a theme switch, you just can’t see or change them in the editor anymore.
2. Change only the content per format
If you only want a different layout for the post content and keep the rest of the page, this is the simplest way, and it hasn’t changed since 2014. Add this to the loop in your single.php, where the post content is printed:
<?php get_template_part( 'content', get_post_format() ); ?>Code language: PHP (php)
Now create a file for each format you want to change, named content-{format}.php, like content-video.php or content-audio.php, and add a content.php that WordPress falls back to for standard posts and formats without their own file.
On my test site, a video post loaded content-video.php, an audio post content-audio.php, and a gallery post (no file for it) content.php. In the child theme, the child’s content-video.php won over the parent’s, so you can override a single format without copying them all. This only works in classic themes, because block themes don’t have single.php.
3. A whole template per format (classic themes)
The old post did this with a template_include snippet that loaded single-video.php for video posts. It still does, but this is what I found when I tested it:
- It ignores the template you pick for a post. I chose a different template for one video post in the editor, and the snippet still replaced it with
single-video.php, becausetemplate_includeruns after WordPress has already decided. - The file name belongs to WordPress.
single-video.phpis also the template for a custom post type named “video”. On my test site, an item of avideopost type loadedsingle-video.phpwithout any snippet. If a plugin adds a post type with that name, your video post template takes over its pages. - It does nothing in a block theme, because it looks for a PHP file that block themes don’t have.
There are multiple ways to fix this, but I prefer the single_template_hierarchy filter. It doesn’t replace WordPress’s decision afterwards, it adds one more file to the list WordPress checks. Copy & paste the following code snippet:
add_filter( 'single_template_hierarchy', 'tp_post_format_template_hierarchy' );
function tp_post_format_template_hierarchy( $templates ) {
$post = get_queried_object();
if ( ! $post instanceof WP_Post ) {
return $templates;
}
$format = get_post_format( $post );
if ( ! $format ) {
return $templates;
}
// After a template picked for the post, ahead of single-post.php and single.php.
$position = array_search( "single-{$post->post_type}.php", $templates, true );
if ( false === $position ) {
$position = count( $templates ) - 1;
}
array_splice( $templates, $position, 0, "single-format-{$format}.php" );
return $templates;
}Code language: PHP (php)
Next, create the template in your (child) theme folder. Name it single-format- followed by the format, for example single-format-video.php or single-format-gallery.php. The easiest start is a copy of your single.php.
This is how it behaved on my test site:
- A video post loaded
single-format-video.php, a gallery postsingle-format-gallery.php. - An audio post (no
single-format-audio.php) and a standard post fell back tosingle.phpas usual, and method 2 still worked inside it. - The video post with a template picked in the editor kept its template.
- In the child theme, the child’s
single-format-video.phpwon. The gallery post, which only had a template in the parent theme, used the parent’s. - The item of the
videopost type kept its ownsingle-video.php.
The filter also works for custom post types that support post formats. If you want it for normal posts only, change the first check to if ( ! $post instanceof WP_Post || 'post' !== $post->post_type ) {.
4. Block themes: a block template per format
Block themes like Twenty Twenty-Five build pages from block templates, not PHP files. The good news is that the filter from step 3 works for them too, because WordPress uses the same list to find block templates. So with the filter active, a template named single-format-video is used for video posts. You can make it in two ways:
- As a file: in a child theme, copy the parent’s
templates/single.htmltotemplates/single-format-video.htmland change it. On my test site, video posts used it straight away. - In the Site Editor: Appearance → Editor → Templates → Add Template → Custom template, and type
single-format-audioas the name. The name becomes the template’s slug, so the filter finds it without any theme file. My audio post used it as soon as I saved it.
It should look like this in the Site Editor:

The Site Editor doesn’t really know about this template. It shows the raw name single-format-video, treats it as a custom template, and lists it in every post’s “Choose a template” menu. A customTemplates entry in the child theme’s theme.json gives it a proper name:
"customTemplates": [
{ "name": "page-no-title", "postTypes": [ "page" ], "title": "Page No Title" },
{ "name": "single-format-video", "postTypes": [ "post" ], "title": "Single: Video format" }
]Code language: JSON / JSON with Comments (json)
Keep the first line if your parent is Twenty Twenty-Five. When I added only my own entry, the child’s list replaced the parent’s, and Twenty Twenty-Five’s “Page No Title” template lost its name.
The block editor doesn’t know about the filter either. On my video post, the Template row said “Single Posts”, while the front end used single-format-video. So “Edit template” from a video post opens the normal single post template. Edit the format template from the Site Editor instead.
5. No code: one post, or a list of all video posts
If you only need a special layout for a few posts, picking the template by hand is simpler than any of the above:
- Block theme: create a custom template in the Site Editor (I named mine “Video posts”), then pick it in the post editor under Template → Change template. It beat the format template on my test site.
- Classic theme: start a template file with the header below, and it shows up in the editor’s template list for posts. My test post loaded it without any snippet.
<?php
/*
* Template Name: Video post
* Template Post Type: post
*/Code language: PHP (php)
And if what you want is a page listing your video posts, WordPress has one built in: /type/video/ (and /type/audio/ and so on). Its template is taxonomy-post_format-post-format-video.php in a classic theme, or taxonomy-post_format-post-format-video.html in a block theme, and the Site Editor lists it as “Post Format: Video”. Both worked on my test site with no code. For a list anywhere else, the Query Loop block has a Formats filter since WordPress 6.7. My test page filtered to Video showed exactly my three video posts, in the classic and in the block theme.
Want a different template per category instead? I tested that too: how to use a different post template per category works with the same kind of filter.
Where to add this code
Add the snippet with a code snippets plugin instead of your theme’s functions.php, so it survives theme updates and you can switch it off without FTP. My guide to adding code snippets safely shows how, using the free Code Snippets plugin. On my own sites I use WPCodeBox, which keeps snippets in a cloud library so the same snippet can go on several sites. Not sure which plugin to choose? I compared Code Snippets, WPCode and WPCodeBox by feeding each one broken snippets. (Marius)
Disclosure: the WPCodeBox link is an affiliate link. If you buy through it, I earn a commission at no extra cost to you.
That’s it! Your video posts (or any other format) now have their own template, and WordPress falls back to the normal one for everything else.
Limitations
- I tested in WordPress Playground with a minimal classic theme, its child theme and a Twenty Twenty-Five child. Themes that already filter their templates may need the filter at a different priority.
- I didn’t test the Classic Editor plugin’s Format box, real video and audio embeds, caching plugins or multisite.
- If you used the 2014 snippet, note that its function name (
load_single_template) is very generic. Another plugin or snippet with the same name would cause a fatal error. That’s from reading the code, I didn’t test it.