小编Dar*_*son的帖子

如何将WordPress帖子水平显示为3列?

我正在将使用Bootstrap构建的主题集成到WordPress中,现在我面临着水平而不是垂直显示帖子的挑战.该设计使用3列.

在这个网站上发布的两个专栏的解决方案(http://perishablepress.com/two-column-horizo​​ntal-sequence-wordpress-post-order/)很有帮助,但是当与3列一起使用时,它会重复发布先前显示的帖子.

这是我的代码:

    <div class="row">

    <?php if (have_posts()) : while(have_posts()) : $i++; if(($i % 2) == 0) : $wp_query->next_post(); else : the_post(); ?>

    <div class="col-sm-4">
    <img src="<?php the_field('home_page_slider_image'); ?>" class="img-responsive" >
    <h3><?php the_field( 'description' ); ?></h3>

    </div>

    <?php endif; endwhile; else: ?>
    <div>Alternate content</div>
    <?php endif; ?>

    <?php $i = 0; rewind_posts(); ?>

    <?php if (have_posts()) : while(have_posts()) : $i++; if(($i % 2) !== 0) : $wp_query->next_post(); else : the_post(); ?>

    <div class="col-sm-4">
    <img src="<?php the_field('home_page_slider_image'); ?>" class="img-responsive" …
Run Code Online (Sandbox Code Playgroud)

css php wordpress twitter-bootstrap

6
推荐指数
1
解决办法
2845
查看次数

标签 统计

css ×1

php ×1

twitter-bootstrap ×1

wordpress ×1