运行循环时显示3列

时间:2016-03-18 09:53:43

标签: php wordpress twitter-bootstrap loops

我正在运行一个循环,并希望在第4行看到每个帖子使用Bootstrap类col-md-4

<div class="container inner-cont staff">
    <div class="row">
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
            <div class="col-md-4">
                <?php the_content(); ?>
                <!-- START MEMBER LOOP -->
                <?php 
                    query_posts(array( 
                        'post_type' => 'mitarbeiter',
                        'showposts' => 10 
                    ) );

                    // Get the members 
                    while (have_posts()) : the_post();
                        ?>                          
                        <a href="mailto:<?= the_field('email'); ?>">
                            <div class="user-box">
                                <div class="row">
                                    <div class="col-md-4">
                                        <?php 
                                        // Display the image
                                        $image = get_field('portraitfoto');
                                        if (!empty($image)): ?>
                                            <img class="sidebar-img" src="<?= $image['url']; ?>" alt="<?= $image['alt']; ?>" /><br />
                                        <?php endif; ?>
                                    </div>
                                    <div class="col-md-8">
                                        <h2><?php the_title(); ?></h2>
                                        <?= the_field('funktion'); ?><br>
                                        <?= the_field('telefon'); ?><br>
                                        <?= the_field('email'); ?><br>
                                        <?php
                                            foreach (get_field('kompetenzen') as $kompetenz) {
                                                echo '<a class="tag" href="'. $kompetenz .'">#'. $kompetenz . '</a> ';
                                            }
                                        ?>
                                    </div>
                                </div>
                            </div>
                        </a>
                    <?php endwhile; ?>
                    <?php wp_reset_query(); ?>
                <!-- END MEMBER LOOP -->
            </div>
        <?php endwhile; else: ?>
        <?php endif; ?>
    </div>
</div>

此代码仅返回1列而不是3.如何使其显示3列?

0 个答案:

没有答案