Tiggles ツ of Speak Creative
4/22/2020 - 7:21 PM

Repeaters Nested Inside Groups

If you are building out sections, and some of them have items, as well as regular content, this may help. Great for sections with copy, followed by a list of items. More info here https://www.advancedcustomfields.com/resources/working-with-nested-repeaters/

<section id="programs">
		<div class="copy">
		<?php
			$programs = get_field('programs');
			if ($programs): ?>
				<?php echo $programs['copy']; ?> 
		</div>
    <div class="programs-wrapper">
    			<!-- // loop through the rows of data -->
    			<?php while ( have_rows('programs') ) : the_row();?>
    				<?php if (have_rows('single_program')): ?>
    					<ul>
    						<?php
    							while(have_rows('single_program')): the_row();
    							$pName = get_sub_field('program_name');
    							$pImg = get_sub_field('program_image');
    							$pDescription = get_sub_field('program_description');
    							$pLink = get_sub_field('program_link'); 
    						?>
    							<!-- we cookin -->
    							<li>
    							    <!-- code here -->
    							</li>
    						<?php endwhile; ?>
    					</ul>
    				<?php endif; ?>
    			<!-- // no rows found -->
    			<?php endwhile; ?>
    </div> <!-- end programs-wrapper --> 
    <?php endif; ?> 
</section>