I am creating a video-archive page for all the posts_format with video.

Currently, I have:

<?php $format = has_post_format('video', $post_id); ?>      


if($layout != "fullwidth") {
    echo '<div class="page_inner">';

if (have_posts()) : while (have_posts()) : the_post();



This is not working, but I do not think I'm far off.

What am I doing wrong?

  • Then how would I display this archive page for only and all video post formats? Mar 20, 2015 at 20:30
  • http://example.com/type/video/
    – Milo
    Mar 20, 2015 at 20:34
  • I'm trying to add a archive-video.php file and also a single-video.php file to fill that URL. I've also tried taxonomy-video.php. No luck so far. Mar 21, 2015 at 23:39
  • Perhaps I need first to register 'video' as a post type? Yet it appears in my post editing sidebar ... Mar 22, 2015 at 0:24

1 Answer 1


I'm not quite sure if you need a dedicated page or a true archive page for this, but here is the two options

If you need a dedicated page to display video post formats, you can make use of a custom query with a tax_query as post_format is just another build in taxonomy with post-format-video being a term to the post_format taxonomy. Your query on your page template should look something like this

$args = array(
    'tax_query' => array(
            'taxonomy' => 'post_format',
            'field' => 'slug',
            'terms' => 'post-format-video'
$q = new WP_Query( $args );

if ( $q->have_posts() ) {
    while ( $q->have_posts() ) {
        $q->the_post() );

        // Your loop


If you need to create a specific archive page for video post format only, you can create a special taxonomy template for this by simply copying your index.php template and renaming it to taxonomy-post_format-post-format-video.php. Everytime you visit this taxonomy page at example.com/type/video or you click on a post-format-video link, this template will be exclusively used to display video post format posts.

Reference: Template Hierarchy


Your comment

news.diginomics.com/type/video What do I name my php file to take advantage of this URL hierarchy?

As I stated, you need a taxonomy template as post_format is one of the 4 build in taxonomies. For a video post format specific template, copy your index.php and rename it


This template will be used everytime you visit news.diginomics.com/type/video

For interest sake, please see this answer I have done about taxonomies


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.