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

<?php

                // The Query
                $query = new WP_Query( array( 
                      'posts_per_page' => 4,
                      'tax_query' => array(
                            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' );
                           endwhile; 
                          wp_reset_postdata();
           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?


Solution:

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: