在wordpress中使用bootstrap,我试图让我的博客页面将第1个最新帖子作为col-sm-12(正在运行),然后将剩下的帖子分成2列,其中所有的偶数#帖子显示在左栏中,奇数#个帖子显示在右栏中。我的左栏循环正在运行,但是我的右栏并没有从第3个帖子开始拉出奇怪的帖子...请帮忙! http://dev.starship.capital/blog/
<div class="container">
<div class="row">
<h2 style="color: white; text-align: center;">Latest Posts</h2>
<?php if (have_posts()) : while(have_posts()) : $i++; if(($i % 2) == 0) : $wp_query->next_post(); else : the_post(); ?>
<?php endif; endwhile; else: ?>
<div class="col-md-6 entry blog-menu">
<article class="entry">
<a href="<?php the_permalink(); ?>">
<div class="blog-overlay"></div>
<?php if ( has_post_thumbnail()) the_post_thumbnail('excerpt-thumb'); ?>
</a>
<div class="entry-content clear">
<div style="padding: 1% 15%;">
<?php the_category(); ?>
<h1 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<p>Posted on: <?php the_time(get_option('date_format') ); ?> By <?php the_author(); ?> | <?php $totalcomments = get_comments_number(); echo $totalcomments; ?> Comments</p>
</div>
</div>
</article>
<?php endif; ?>
</div>
<?php if (have_posts()) : while(have_posts()) : $i++; if(($i % 2) !== 0) : $wp_query->next_post(); else : the_post(); ?>
<?php endif; endwhile; else: ?>
<div class="col-md-6 entry blog-menu">
<article class="entry">
<a href="<?php the_permalink(); ?>">
<div class="blog-overlay"></div>
<?php if ( has_post_thumbnail()) the_post_thumbnail('excerpt-thumb'); ?>
</a>
<div class="entry-content clear">
<div style="padding: 1% 15%;">
<?php the_category(); ?>
<h1 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<p>Posted on: <?php the_time(get_option('date_format') ); ?> By <?php the_author(); ?> | <?php $totalcomments = get_comments_number(); echo $totalcomments; ?> Comments</p>
</div>
</div>
</article>
<?php endif; ?>
<?php endwhile; ?>
</div>
</div>