I actually stuck to display a ‘video’ post format in the video section on main page. Here is my current code:


                // The Query
                $query = new WP_Query( array( 
                      'posts_per_page' => 4,
                      'tax_query' => array(
                                'taxonomy' => 'post_format',
                                'field' => 'slug',
                                'terms' => array('post-format-video'),
                                'operator' => 'IN'
                ) );

                if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); 
                            get_template_part( 'template/loop', 'video' );
           else : ?>
           <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
           <?php endif; ?>

That code did not work. Anyone can advise? Thanks!

Read more here: How to display just video post format?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: