I have files in my theme called single-audio.php and single video.php, but when I click on an audio post-format or video post-format wordpress uses the index.php instead of my single-audio.php or single-video.php files. Any ideas?

  • if those are template files, you would need to associate them to a page. A page uses index.php as the default template file.
    – rexposadas
    Commented Jan 30, 2012 at 22:54
  • thanks how do I associate them?
    – James
    Commented Jan 30, 2012 at 22:58
  • single-audio.php would be a single post in a post type called audio, not a post format.
    – Jared
    Commented Jan 30, 2012 at 23:02
  • and a page uses page.php as the default template file, index.php is a fallback. Commented Jan 30, 2012 at 23:08
  • 1
    @Jared you should post that as an answer (ideally, along with an example get_template_part() call for including post format-specific content). Commented Jan 31, 2012 at 2:26

3 Answers 3


There is a huge difference between Post Formats and Post Types. I am assuming you are using post formats, which do not have a default template file for you to use.

What you can do though is use has_post_format() to see if the post has the format you are using, and if it does, use get_template_part() to get a specific template file that you created to display there.

For example:

// If this post has a post format of 'video'
if( has_post_format( 'video', $post->ID ) ) {

    // Then get and display 'single-video.php'
    get_template_part( 'single', 'video' );


If you really want to use single files for each post-format type you could try something like this: (paste to functions.php)

function post_format_template() {
global $post;
$format = get_post_format($post->ID);
if ( is_single() && $format ) {
add_action('template_redirect', 'post_format_template',10);

It's a possible solution, but I wouldn't recommend it, as long as you're not 100% sure about what you're doing resp. what is happening here.

Jared response is the recommended way of dealing with post-formats.


If I understand your question correctly, you would need to do the following:

  1. Add a new page via the Dashboard
  2. Give that new page a name like "Audio post format" and associate that page to a template. There is a selectbox which would allow you to select a template.


  • Thanks. According to the wordpress Template Hierarchy when displaying a post it should look for single-$posttype.php then single.php then index.php I can't undersatnd if I have a single-audio.php file why its not using that?
    – James
    Commented Jan 30, 2012 at 23:30
  • because you're using post-formats, not post-types. post formats don't have a dedicated template file. Commented Jan 31, 2012 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.