Support

Account

Home Forums Add-ons Repeater Field Need to show two Sub Fields on each div Reply To: Need to show two Sub Fields on each div

  • 
    <?php 
      if (have_rows('testimonials-int')) { 
        $count = 0;
        ?>
          <!-- open the first row -->
          <div class="row">
            <?php 
              while(have_rows('testimonials-int')) {
                the_row();
                if ($count > 0 && ($count % 2 == 0)) {
                  // close row and open new row
                  ?>
                    </div>
                    <div class="row">
                  <?php
                }
        
                $image = get_sub_field('avatar-int');
                $content = get_sub_field('content-int');
                $name = get_sub_field('name-int');
        
                ?>
                  <div class="medium-6 columns">
                    <img src="<?php echo $image; ?>" alt="Testimonials" />
                    <?php echo $content; ?>
                    <span><?php echo $name; ?></span>
                  </div>
                <?php 
                $count++;
              }
            ?>
          </div><!-- close the last row -->
        <?php 
      }