ACF中继器字段输出一列而不是在三列中输出



我有一个带有两个子字段的中继器字段(均为文本(,我希望它们在三列中显示。目前,它们出现在一个列中,每个中继器字段都出现在新行中,而不是在三列中出现。

这是我的代码:

<div class="container staff"> <!-- Staff -->
<div class="row">
    <div class="col-lg-4">                                                  
            <?php if( have_rows('directors_info') ): ?>
                <?php while ( have_rows('directors_info') ) : the_row(); ?>
                    <?php the_sub_field('name'); ?>
                    <?php the_sub_field('profile'); ?>
                <?php endwhile; ?>
            <?php endif; ?>                                                 
    </div>
</div>

您只使用一个列而不是在每次迭代中创建一个列。尝试这样的事情:

<div class="container staff"> <!-- Staff -->
  <?php if( have_rows('directors_info') ): ?>
    <div class="row">
      <?php while ( have_rows('directors_info') ) : the_row(); ?>
        <div class="col-lg-4">
          <?php the_sub_field('name'); ?>
          <?php the_sub_field('profile'); ?>
        </div>
      <?php endwhile; ?>
    </div>
  <?php endif; ?>
</div>

这将生成类似于此的东西http://jsfiddle.net/k0l7dvpc/

最新更新