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; ?>"> <?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;
?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.