Home › Forums › Add-ons › Repeater Field › Post object field inside repeater field › Reply To: Post object field inside repeater field
Yes, I finally figured out how to show the name! I’ve watched again Mr.Digitals Tutorials on YouTube, simplified your solution, made some trial and errors and finally it works. The code looks like this now:
<?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-5"> <?php $translator = get_sub_field('translator_name'); echo $translator->translator_first_name." "; echo $translator->translator_last_name; ?> </div> <div class="col-md-5"> <?php $payment_method = get_sub_field('translator_payment_method'); echo $payment_method; ?> </div> <?php endwhile; endif; ?>
In the end, it was much simpler than expected. Just putting the sub_field in a variable and the access it.
$translator = get_sub_field('translator_name'); echo $translator->translator_first_name." "; echo $translator->translator_last_name;
But there are still a few challenges open. Let’s see how it works …
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!
🤔 Curious about the ACF user experience? So are we! Help guide the evolution of ACF by taking part in our first ever Annual Survey and guarantee you’re represented in the results. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 8, 2023
© 2023 Advanced Custom Fields.