I was able to divide posts into two columns but I have a problem if the loop has an odd number of posts. If the loop has an odd number of posts, like 9, the right side has the most posts than the left side. What I want is if the loop has an odd number of posts, they favor the left side instead of the right side.
For example: this is what the loop outputs if it has 7 posts:
Post left | Post right
Post left | Post right
Post left | Post right
Post left | ----------
What I'm trying to accomplish:
Post left | Post right
Post left | Post right
Post left | Post right
--------- | Post right
The code used to split the loop:
<?php $row_start = 1; while ( $query->have_posts() ) : $query->the_post();?>
<?php if( in_array( get_the_ID(), $duplicates ) ) continue; ?>
<?php if( $row_start % 2 != 0) { ?>
<?php $left[] = get_the_ID(); ?>
<?php } else { ?>
<?php $right[] = get_the_ID(); ?>
<?php } ?>
<?php ++$row_start; endwhile; wp_reset_postdata();?>
Thanks for the help.