我希望按照所选类别获取wordpress帖子,并将其显示如下
<div class="row">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="row">
<div class="item"></div>
<div class="item"></div>
</div>
<div class="row">
<div class="item"></div>
<div class="item"></div>
</div>
...
我不知道如何循环这篇文章。任何人都可以帮我解决这个问题吗?
这是我的wordpress代码
<?php $args = array(
'numberposts' => 99999,
'category_name' => 'res-image-gallery');
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
//this block should like row with to post...
<div class="row">
<div class="item"> </div>
<div class="item"> </div>
</div>
<?php endwhile;?>
<?php endif;?>