If I remove the if statements, this works perfectly. However with the IF statement in, I only see the first row from the repeater. What am I doing wrong? (thanks in advance!)
<?php if( have_rows('activity_links') ): the_row(); ?>
<h3>Links</h3>
<ul>
<?php while( have_rows('activity_links') ): the_row(); ?>
<li><a href="<?php echo the_sub_field('link_url'); ?>"><?php echo the_sub_field('name_for_link'); ?></a></li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
You don’t need “the_row()” on the first line. The correct code would be:
<?php if(have_rows('activity_links')): ?>
<h3>Links</h3>
<ul>
<?php while(have_rows('activity_links')): the_row(); ?>
<li><a href="<?php echo the_sub_field('link_url'); ?>"><?php echo the_sub_field('name_for_link'); ?></a></li>
<?php endwhile; ?>
</ul>
<?php endif; ?>