WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Custom Fields
Mistake in my nested repeater? (2 posts)

  1. Dvd709
    Member
    Posted 5 months ago #

    Hi guys, 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;
    				?>
    			<?php endwhile; ?>
    		<?php endif; ?>
    	<?php endwhile; ?>
    <?php endif; ?>

    Thanks in advance!

    https://wordpress.org/plugins/advanced-custom-fields/

  2. domokun
    Member
    Posted 4 months ago #

    Two things.

    $show = the_sub_field('officetype');

    Should be:

    $show = get_sub_field('officetype');

    Secondly, is officetype an array?

    What does print_r($show); give you?

Reply

You must log in to post.

About this Plugin

About this Topic