I’m trying to create a ‘two posts per row grid’.
Here is the template i made:
<div class="row">
<div class="span2">
<?php get_sidebar(); ?>
</div>
<div class="span4 pull-left">
<?php query_posts('category_name=portfolio&posts_per_page=100'); $do_not_duplicate = $post->ID;?>
<?php if (have_posts()) : while (have_posts()) : the_post();
if (in_array($post->ID, $do_not_duplicate)) continue;
?>
<?php the_content(); ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, this page does not exist.'); ?></p>
<?php endif; ?>
</div>
<div class="span4 pull-right">
<?php query_posts('category_name=portfolio&posts_per_page=100'); $do_not_duplicate = $post->ID;?>
<?php if (have_posts()) : while (have_posts()) : the_post();
if (in_array($post->ID, $do_not_duplicate)) continue;
?>
<?php the_content(); ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, this page does not exist.'); ?></p>
<?php endif; ?>
</div>
Something is wrong, cause all posts are visible in both divs, how do I tell wordpress to only add odd posts to the first div and even posts to the second?
Ended up with using this code: