Support

Account

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; ?>">&nbsp;<?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 …