Home › Forums › Add-ons › Repeater Field › Can't get repeater in group field to return true with have_rows() › Reply To: Can't get repeater in group field to return true with have_rows()
I apologize for the delayed response.
I tried what you recommended but did not work. However, I did figure out a way to make it work. I had to first surround everything in the have_rows() and the_row() of the group field.
This is what worked for me:
$group = get_field('group_field'); $heading = $group['heading']; $text = $group['text']; // repeater field is called 'links_list' // repeater sub field called 'link' if( have_rows('group_field') ) : while( have_rows('group_field') : the_row(); ?> <h3><?php echo $heading; ?></h3> <?php echo $text; ?> <?php if( have_rows('links_list') ) : ?> <ul class="links-list"> <?php while( have_rows('lists_list') ) : the_row(); $link = get_sub_field('link'); ?> <li><a href="<?php echo $link['url']; ?>" target="<?php echo $link['target']; ?>"><?php echo $link['title']; ?></a></li> <?php endwhile; ?> </ul> <?php endif; ?> <?php endwhile; 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!