ACF Nested Repeater Fields and Genesis

Community Forums Forums General Discussion ACF Nested Repeater Fields and Genesis

This topic is: not resolved

This topic contains 3 replies, has 3 voices, and was last updated by  genwrock 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #115624

    hophead99
    Participant
    Post count: 7

    I would be enormously grateful if someone could help me with the following.

    I have been using Genesis with ACF for many years but have always struggled to implement Nested Repeater Fields using ACF.
    I am not a web designer who understands a great deal about PHP but I do use a whole bunch of snippets that get me through – anyway I am using the following in my fuctions file which returns my custom fields nice and clean and styled just the way I like:

    add_action('genesis_entry_footer', 'program_material',3);
    function program_material() {
    
    echo '<div class="program">';
    
    if ( is_page() && get_field('session_4a_programme')){
    echo '<div class="prog_sessions">';
    while(has_sub_field('session_4a_programme')){ 
    echo '<div class="sessionprog">';
    echo '<div class="prog_time">' . get_sub_field('time_a') .'</div>', 				
         '<div class="prog_title">' . get_sub_field('title_1_a') .'</div>',
         '<div class="prog_subject">' . get_sub_field('title_subject_a') .'</div>',
         '<div class="prog_speaker">' . get_sub_field('speaker_a') .'</div>',
         '<div class="prog_moderator">' . get_sub_field('moderator_b') .'</div>'; 
    echo '</div>';  
    }
    echo '</div>';  
    }
    
    }

    So the main field session_4a_programme is the parent repeater
    What I need to do is turn the last field – moderator_b into a child repeater with a couple of fields for Name and Company.

    I’m really struggling and would be very grateful to the community if someone could provide me with some suggestions about how I can amend the code above to accommodate the nested repeater functionality

    Kind Regards

    Phil

    https://www.shippinginnovation.com/isss-2014-program/
    #115653

    essaysnark
    Participant
    Post count: 342

    This sounds like a question for the ACF folks. Have you tried posting over there?

    #115667

    hophead99
    Participant
    Post count: 7

    Hey

    Thanks for getting back to me – yes I have indeed sent ACF an email on this very subject.
    However the original way of doing this I got from Nick (the geek) on the old forum a couple of years ago – I just thought someone in the General Genesis Community may have come across this issue of Nested Repeater fields before…and may have a solution, I’m sure it’s not hugely complicated – but I just can’t get my head around it…

    Phil

    #115669

    genwrock
    Member
    Post count: 857

    i think that process will be like this way

    echo '<div class="prog_time">' . get_sub_field('time_a') .'</div>', 				
         '<div class="prog_title">' . get_sub_field('title_1_a') .'</div>',
         '<div class="prog_subject">' . get_sub_field('title_subject_a') .'</div>',
         '<div class="prog_speaker">' . get_sub_field('speaker_a') .'</div>';
    if( get_sub_field('moderator_b') ) {
        echo '<div class="prog_moderator">' ;
        while ( has_sub_field('moderator_b') ){ 
           echo get_sub_field('name')  .  '<br/>' .  get_sub_field('company') ;
           echo '</div>';
        }
     }

    See My PRO Genesis Child Themes | Need Genesis Developer? | Follow Me on Twitter

    • This reply was modified 4 months ago by  genwrock.
    • This reply was modified 4 months ago by  genwrock.
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.