Wordpress - 循环中的bootstrap列6 - 如何添加行

时间:2016-08-18 10:06:46

标签: wordpress twitter-bootstrap loops grid-layout

想要在bootstrap网格中显示博客帖子,6列。我错过了行,现在不知道怎么把它包含在网格中。没有排第三个帖子去第四个应该是。第三名的位置是空的。

<div id="blog">

    <?php $i = 0; ?>

    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

        <?php if ( $i === 0 ) {
            echo '<div class="col-md-6">';
        } ?>

        <?php if ( $i === 1 ) {
            echo '<div class="col-md-6">';
        } ?>

        <div class="blog">

            <?php
            if ( is_single() ) :
                the_title( '<h3 class="entry-title">', '</h1>' );
            else :
                the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' );
            endif;

            if ( 'post' === get_post_type() ) : ?>

            <!-- Content-->
            <div class="entry-content">
                <?php
                the_excerpt( sprintf(/* translators: %s: Name of current post. */
                    wp_kses( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'black_jack_ohearts' ), array( 'span' => array( 'class' => array() ) ) ), the_title( '<span class="screen-reader-text">"', '"</span>', false ) ) );

                wp_link_pages( array(
                    'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'black_jack_ohearts' ),
                    'after'  => '</div>',
                ) );
                ?>
            </div>

        </div><!-- .blog-->

        <?php $i ++; ?>

    </div><!-- #post -->
</div><!-- #col-6 -->
</div><!-- #blog -->

1 个答案:

答案 0 :(得分:0)

可能重复:Wordpress Loop posts in Bootstrap 3 grid layout

我想你会在那里找到答案。