Support

Account

Home Forums Add-ons Repeater Field Post object field inside repeater field Reply To: Post object field inside repeater field

  • Thanks for your reply! Unfortunately the code doesn’t work yet, no output. I wonder if I have missed something in the configuration of the fields. The return format of the repeater field is “Post object”. Also, I modified your code a bit so that I don’t query the rows twice. The code currently looks like this:

    <?php
    										if( have_rows('translation_translator') ):
    										while ( have_rows('translation_translator') ) : the_row(); ?>
    
    										<?php
    											$language = get_sub_field('translator_language');
    										?>
    
    										<div class="col-2">
    										<img src="<?php echo get_stylesheet_directory_uri(); ?>/img/flags-iso/<?php echo $language->slug; ?>.png" title="<?php echo $language->name; ?>">&nbsp;<?php echo $language->name; ?>
    										</div>
    
    										<div class="col-10">
    										<?php
    											$translator_name = get_sub_field( 'translator_name' );
    											if ( $translator_name ) :
    											$post = $translator_name;
    											setup_postdata( $post ); 
    										?>
    										<?php the_sub_field('translator_first_name') ?>
    										<?php wp_reset_postdata(); ?>
    										<?php endif; ?>
    										</div>
    										<?php
    											endwhile;
    											endif;
    										?>