Home Forums General Issues Nested repeater within flexible content Reply To: Nested repeater within flexible content

  • Hi @theshae

    Please remember that the get_sub_field function only works WITHIN a has_sub_field or have_rows loop.

    You are correctly using a has_sub_field loop for the flexible content field, but are not using it again for the nested repeater field.

    You need to change your inner loop to:

    <?php if(get_sub_field("menu_items")): ?>
    	<?php while(has_sub_field("menu_items")): ?>
    	<li class="dontsplit">
    	<h3><?php echo get_sub_field("item_name"); ?>
    	<?php if(get_sub_field("price")): ?>
    	<?php foreach(get_sub_field("price") as $p): ?>
    	<?php echo $p['price_option']; ?>
    	<?php endforeach; ?>
    	<?php endif; ?>
    	<p><?php echo get_sub_field("item_description"); ?></p>
    	<?php endforeach; ?>
    <?php endif; ?>

    Hope that helps.