Home › Forums › Add-ons › Repeater Field › Is there a way to separate repeater rows by groups of five? › Reply To: Is there a way to separate repeater rows by groups of five?
Ok, this is what I mean.
<div class="tabz">
<?php if( have_rows('employees') ): ?>
<ul class="employees">
<?php $count = 1; ?>
<?php while ( have_rows('employees') ) : the_row(); ?>
<li><a href="#employee-<?php echo $count; ?>" style="background-image: url(<?php the_sub_field('photo'); ?>);"><div class="hover"><?php the_sub_field('title'); ?></div></a><strong><?php the_sub_field('name'); ?></strong></li>
<?php $count++; endwhile; ?>
</ul>
<?php endif; ?>
<?php if( have_rows('employees') ): ?>
<?php $count = 1; ?>
<?php while ( have_rows('employees') ) : the_row(); ?>
<div id="employee-<?php echo $count; ?>" class="employee-bio">
<div class="row">
<figure style="background-image: url(<?php the_sub_field('photo'); ?>);"></figure>
<article>
<h2><?php the_sub_field('name'); ?></h2>
<h3><?php the_sub_field('title'); ?></h3>
<?php the_sub_field('biography'); ?>
</article>
</div>
</div>
<?php $count++; endwhile; ?>
<?php endif; ?>
</div>
I want to run both for every 5 rows
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!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5
— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.