I m trying to use repeater inside repeater field any body can help me

I am trying to use repeater inside repeater field. Could you please point me to where is the mistake?

<?php if(get_field('help_blocks')): ?>
    <?php while(has_sub_field('help_blocks')): ?>
        <div class="col-sm-4">
            <div class="block">

                <h5><?php the_sub_field('block_title'); ?></h5>
                <?php the_sub_field('block_paragraph'); ?>

                <?php if(get_field('block_list')): ?>
                <ul class="list-style">
                    <?php while(has_sub_field('block_list')): ?>                    
                    <li><?php the_sub_field('list_item'); ?></li>
                    <?php endwhile; ?>                  
                </ul>
                <?php endif; ?>

                <img src="<?php the_sub_field('block_image'); ?>" alt="" />
                <div class="text-center">
                    <a class="btn btn-primary" href="<?php the_sub_field('block_button_link'); ?>"><?php the_sub_field('block_button'); ?></a>
                </div>      
            </div>
        </div>
    <?php endwhile; ?>
<?php endif; ?>

Related posts

1 comment

  1. It looks like you’re almost there.

    You have this line:

    <?php if(get_field('block_list')): ?>
    

    It should be:

    <?php if(get_sub_field('block_list')): ?>
    

    Your nested repeater is a sub field of your repeater, so you need to use get_sub_field.

Comments are closed.