Question

I have a repeater which I will show below which isn't returning any errors as well as it's not returning anything. (Echo not working)

I'm trying to show the sub field officetype but this is the setup:

Offices(repeater)->Officetypeinfo(repeater)->Multiple sub fields(E.g. officetype)

Can anyone tell me what I did wrong, please do tell me if you need more then what I provided.

<?php if( get_field('offices')): ?>
    <?php while( has_sub_field('offices')): ?>
        <?php if( get_sub_field('officetypeinfo')): ?>
            <?php while( has_sub_field('officetypeinfo')): ?>
                <?php
                    $show = the_sub_field('officetype');
                       echo $show;
                       the_sub_field('officetype');
                ?>
            <?php endwhile; ?>
        <?php endif; ?>
    <?php endwhile; ?>
<?php endif; ?>

Thanks in advance!

Was it helpful?

Solution

There is no need to add the_sub_field('officetype'); after echo $show;

Did you check that you're using the right field-names? Try var_dump('field-name'); to check where it goes wrong.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top