我正在尝试创建“每行两个帖子网格”。这是我制作的模板:
<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>
有点不对劲,因为所有帖子都在两个分区中可见,我如何告诉wordpress只在第一个分区中添加奇数帖子,在第二个分区中添加偶数帖子?