Multi row post list

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?

Related posts

1 comment

  1. Ended up with using this code:

    <?php query_posts('category_name=Menucard'); ?>
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
        <div class="span4 post move pull-left">
            <?php
                //echo post here
                the_content();
            ?>
    
        </div> <!-- close .post div -->
    
        <?php
            $counter++;
            if ($counter % 3 == 0) {
            echo '<div style="clear:both;"></div>';
            }
        ?>
    

Comments are closed.