Home › Forums › Add-ons › Repeater Field › Create a new Row after 3 Columns › Reply To: Create a new Row after 3 Columns
Another follow up with a solution, hopefully this helps someone – the first “while” was producing an infinite loop: <?php while ( have_posts() ) : the_post(); ?>
Once that was removed I managed to make this working, here’s the full code:
<?php
$i = 0;
?>
<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
// check for rows (parent repeater)
if( have_rows('about_team_sections') ): ?>
<?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(get_sub_field('image'))?>" alt="">
</div>
<div class="ab-team-content">
<div class="ab-team-name font-windsor-bold fs-21"><?=get_sub_field('name')?></div>
<div class="ab-team-position text-uppercase fs-12 letter-spacing-200"><b><?=get_sub_field('position')?></b></div>
<div class="ab-team-social-media">
<ul>
<?=get_sub_field('social_media')?>
</ul>
</div>
</div>
</div>
</div><!-- end .ab-team-item -->
<?php endwhile; ?>
<?php endif; //if( get_sub_field('team_section') ): ?>
</div>
<?php endwhile; // while( has_sub_field('about_team_sections') ): ?>
<?php endif; // if( get_field('about_team_sections') ): ?>
</div><!-- end .container -->
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.