好的,我知道了!这个代码对我来说非常适用。:)
<?php $args=array(
\'post_type\' => \'post\',
\'posts_per_page\' => 4,
\'paged\' => $paged,
\'tax_query\' => array(
array(
\'taxonomy\' => \'post_format\',
\'field\' => \'slug\',
\'terms\' => array(\'post-format-video\'),
\'operator\' => \'IN\')
)
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
$i = 0;
while ($my_query->have_posts()) : $my_query->the_post();
// modified to work with 3 columns
// output an open <div>
if($i % 4 == 0) { ?>
<div class="row">
<?php
}
?>
<?php get_template_part( \'template/loop\', \'video\' ); ?>
<?php $i++;
if($i != 0 && $i % 4 == 0) { ?>
</div><!--/.row-->
<div class="clearfix"></div>
<?php
} ?>
<?php endwhile; } wp_reset_query();?>