I want to loop my posts into a 2 column grid, but if there is an odd number of posts, there is an empty space on the even side of the grid.
How could I get an image to appear in this empty space only if there are an odd number of posts? So it would be:
Post 1 | Post 2 Post 3 | img
I tried using the code here, but not sure how to apply the
Modulo Operator because the image should appear after the loop, no?
If my code is super basic like:
<div class="small-12 large-6 columns end"> <?php if (have_posts()): while (have_posts()) : the_post(); ?> Post title, thumbnail, excerpt, etc <?php endwhile; endif; ?> </div>