I would like to wrap every three posts in a new line (div), for a total of nine posts per page. There is an empty line at the end. I thought it was ( I need to wrap every 4 Wordpress posts in a div ), but I have more posts on pages 2, 3, 4, etc. Below is a simplified version of my code. $ i = 1.
<div class="row">
<?php while ( have_posts() ) : the_post(); ?>
<div class="column">
</div>
<?php if ($i % 3 == 0 ) : ?>
</div>
<div class="row">
<?php endif; $i++; ?>
<?php endwhile; ?>
</div>
source
share