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
}
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.