My best guess would be define even as a multiple of two… Then on the odd post if even = false then show the post.
thanks for the comment, sadly I have no idea how to put that into code (I can just about code wordpress templates but not php).
at the moment i’m using this for the first column:
<?php global $post; $myposts = get_posts('numberposts=5'); foreach($myposts as $post) : setup_postdata($post);?>
I just need to adapt it so it shows even / odd posts.
anyone have an idea of how I could get this to work?
how do you define an odd post?
this might work (untested):
<?php
global $post; $myposts = get_posts('numberposts=10');
?>
<div class="column-odd">
<?php
$i=1;
foreach($myposts as $post) :
if($i%2 != 0) :
setup_postdata($post);
//output odd post in the usual way
endif;
$i++;
endforeach;
?>
</div>
<div class="column-even">
<?php
$i=1;
foreach($myposts as $post) :
if($i%2 == 0) :
setup_postdata($post);
//output even post in the usual way
endif;
$i++;
endforeach;
?>
</div>
styles:
.column-odd{ float:left; width: 48%; }
.column-even { float:left; width: 48%; }
Worked like a charm. Thanks!