<?php
$row_start = 1;
while ( have_posts() ) : the_post();
if( $row_start % 2 != 0) {// odd
?>
<div class="left-side">
<?php get_template_part( 'blog','item'); ?>
</div>
<?php
}
if( $row_start % 2 == 0) {// even
?>
<div class="right-side">
<?php get_template_part( 'blog','item');?>
</div>
<?php
}
++$row_start;
endwhile;
?>
You could always break in and out of PHP to achieve what you’re after. I haven’t tested the above, but something similar should work.
Or …
You could avoid breaking in and out of PHP by echoing the HTML:
<?php
$row_start = 1;
while ( have_posts() ) : the_post();
if( $row_start % 2 != 0) {// odd
echo '<div class="left-side">';
get_template_part( 'blog','item');
echo '</div>';
}
if( $row_start % 2 == 0) {// even
echo '<div class="right-side">';
get_template_part( 'blog','item');
echo '</div>';
}
++$row_start;
endwhile;
?>