我正在尝试在中继器字段中使用中继器,任何机构都可以帮助我


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

我正在尝试在中继器字段中使用中继器。你能指出我错误在哪里吗?

<?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; ?>

看起来你快到了。

你有这一行:

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

它应该是:

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

嵌套转发器是转发器的子字段,因此需要使用get_sub_field。