Home › Forums › Front-end Issues › Change column size based on amount of elements (repeater fields) › Reply To: Change column size based on amount of elements (repeater fields)
instead on using the_sub_field()
use get_sub_field()
for the values and check to see that each has a value.
I’m not really sure how to do this by looking at your code. If I’m getting what you’re doing right then if you’re looking at the first item for the row then you need to look ahead to the next row and that’s not something that possible using a have_rows
loop. Instead what you’ll need to do is get the entire repeater into an array and loop over the array instead.
// this will show you what's in the repeater
$rows = get_field('columns_carousel_slide');
echo '<pre>'; print_r($rows); echo '</pre>';
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!
Accordions are a great way to group related information while allowing users to interactively show and hide content. In this video, Damon Cook goes in-depth on how to create an accessible accordion block using ACF PRO’s Repeater field.https://t.co/RXT0g25akN
— Advanced Custom Fields (@wp_acf) March 2, 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.