【发布时间】:2016-10-09 03:41:26
【问题描述】:
我想将每三个帖子换成一个新行 (div),一个页面上总共有九个帖子。最后有一个空行。我认为这 (I need to wrap every 4 wordpress posts in a div) 会起作用,但我在第 2、3、4 页等有更多帖子。下面是我的代码的简化版本。 $i = 1。
<div class="row">
<?php while ( have_posts() ) : the_post(); ?>
<div class="column">
</div>
<?php if ($i % 3 == 0 ) : ?>
</div> <!-- .row -->
<div class="row">
<?php endif; $i++; ?>
<?php endwhile; ?>
</div> <!-- .row -->
【问题讨论】: