Support

Account

Home Forums Add-ons Repeater Field Repeater Field and Bootstrap Rows

Unread

Repeater Field and Bootstrap Rows

  • Hi Everyone,
    I’m pretty new to PHP, so this might not be that hard to figure out, but just thought I’d ask here. I am trying to make the repeater field break up every 2 team members by row. Right now they are all generating within the same row, which causes them to show up as a masonry layout. Is there a way to limit the amount of columns per row with the Repeater field or create this effect with bootstrap’s rows? Any leads would be much appreciated!

    Here is my code so far:

    <h2>Team Members</h2>
            <div class="row">
    
                <?php
                  // check if the repeater field has rows of data
                  if( have_rows('team_member') ):
                   
                    // loop through the rows of data
                      while ( have_rows('team_member') ) : the_row(); ?>
                      
                      <div class="col-sm-6">
                          <div class="panel panel-default">
                            <div class="panel-body">
                              <img src="<?php the_sub_field('team_member_image'); ?>" class="img-circle" style="width:100px;float:right;margin:0 0 10px 10px;">
                              <h3><?php the_sub_field('name'); ?></h3>
                              <p><strong><?php the_sub_field('position'); ?></strong></p>
                              <p><?php the_sub_field('description') ?></p>
                            </div>
                          </div>
                       </div>
    
                  <?php  endwhile;
                   
                  else : ?>
                   
                      <p>Please Add Team Members</p>
    
              <?php endif; ?>
    
            </div><!--End repeater row-->
Viewing 1 post (of 1 total)

The topic ‘Repeater Field and Bootstrap Rows’ is closed to new replies.