Home › Forums › Add-ons › Repeater Field › Wrap entire Repeater Field in a wrapper › Reply To: Wrap entire Repeater Field in a wrapper
I solved this but maybe this might help someone! I was making it WAY harder then it was!
Here is what I did to get a class called ‘multiple’ or wrapper around my repeater:
<?php //begin some repeating fields for if multiple trips to same country */
elseif (get_row_layout() == 'trip_card') : ?>
<?php if (have_rows('multiple_trips')) :
echo '<div class="multiple">'; //begin wrapper
// loop through the rows of data
while (have_rows('multiple_trips')) : the_row(); ?>
<?php
//vars
$first_trip_title = get_sub_field('first_trip_title');
$first_trip_date = get_sub_field('first_trip_date');
//$counter = 2;
//display a sub field value
?>
<div><strong><?php echo $first_trip_title; ?>:</strong>
<?php echo $first_trip_date; ?></div>
<?php endwhile;
echo '</div>' ?>
<!-- end of wrapper: multiple -->
<?php else : ?>
<?php // no rows found
?>
<?php endif; ?>
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.