Support

Account

Home Forums Add-ons Repeater Field Create a new Row after 3 Columns Reply To: Create a new Row after 3 Columns

  • Following up – I decided to use nested repeater approach for this, however it’s producing an endless loop for the following code:

    <?php
    
    $team = get_sub_field('team_section');
    
    ?>
    
    <div id="team" class="d-none d-md-block m-t-90 p-b-100 border-bee border-bee-vertical border-bee--gray border-bee--left"></div>
    	<div class="container">
    
    		<?php while ( have_posts() ) : the_post(); ?>
    
    			<?php
    
    			// check for rows (parent repeater)
    			if( have_rows('about_team_sections') ): ?>
    				<div id="team">
    				<?php
    				// loop through rows (parent repeater)
    				while( have_rows('about_team_sections') ): the_row(); ?>
    					<div class="row team-row">
    						<?php
    						// check for rows (sub repeater)
    						if( have_rows('team_section') ): ?>
    
    							<?php
    							// loop through rows (sub repeater)
    							while( have_rows('team_section') ): the_row();
    
    								// display columns
    								?>
    
    								<div class="col-md-4 ab-team-item">
    									<div class="ab-team text-center" data-id="<?=$i?>" data-scroll-animate="fadeIn">
    										<div class="ab-team-image">
    											<img src="<?=\AB\Template\get_image_url($team['image'])?>" alt="">
    										</div>
    										<div class="ab-team-content">
    											<div class="ab-team-name font-windsor-bold fs-21"><?=$team['name']?></div>
    											<div class="ab-team-position text-uppercase fs-12 letter-spacing-200"><b><?=$team['position']?></b></div>
    											<div class="ab-team-social-media">
    												<ul>
    													<?=$team['social_media']?>
    												</ul>
    											</div>
    										</div>
    									</div>
    								</div>
    
    							<?php endwhile; ?>
    
    						<?php endif; //if( get_sub_field('team_section') ): ?>
    					</div>
    
    				<?php endwhile; // while( has_sub_field('about_team_sections') ): ?>
    				</div>
    			<?php endif; // if( get_field('about_team_sections') ): ?>
    
    		<?php endwhile; // end of the loop. ?>
    	</div><!-- end .container -->