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?

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' );

}

Leave a Reply

Your email address will not be published. Required fields are marked *