Support

Account

Forum Replies Created

  • Thank you very much for your advice! I see that the problem is indeed rather complex and I need to delve into it a bit. If I find a concrete solution, I will be happy to post it here.

  • 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 …

  • 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;
    										?>
  • Ok, thanks for your feedback! In the meantime I think I fixed the problem by myself by creating indiviual queries for every entry, all surrounded by a variable for every video thats gives me the video number and which I use as meta_value.

    Thanks for your help anyway and greetings!
    Adriano

  • Thanks for your response!

    No, I don’t use repeaters. You’ll find the actual code here: https://gist.github.com/anonymous/944264e6cb6f10ea4948ef4240cf2b60

    Actually I get a list of all entries with their field values. Thats not bad, but I want to merge every video with specific field entries:
    – Video #
    – Topic (topic-field in first scene for every video)
    – Time (time-field in last scene for every video)
    – Check (if any on the scene for every video is checked)

    I’ve made a screenshot with the actual list and two examples of merged entries on video 1 and 5.

    Multiple Queries

    Hope this helps. Thanks for your help!

  • Hi James

    Fantastic, thank you very much!
    That points me into the right direction and now I just have to combine this with the bootstrap accordion code and I will get a nice dropdown list.

    Greetings,
    Adriano

Viewing 6 posts - 1 through 6 (of 6 total)