我有一个代码,在div中每4篇文章就包装一次。我如何调整它以在div中每月包装一篇文章。
<?php
$args = array(
\'post_type\' => \'posts\',
\'posts_per_page\' => -1,
\'order\' => \'DESC\'
);
$the_query = new WP_Query($args);
if ($the_query->have_posts()) :
$counter = 0;
while ($the_query->have_posts()) : $the_query->the_post();
if ($counter % 4 == 0) :
echo $counter > 0 ? "</div>" : "";
echo "<div class=\'row\'>";
endif;
?>
<div class="col-3">
<?php the_title(); ?>
</div>
<?php
$counter++;
endwhile;
endif;
wp_reset_postdata();
?>