Community Forums › Forums › Archived Forums › General Discussion › ACF Nested Repeater Fields and Genesis
Tagged: ACF Nested Repeater Fields
- This topic has 3 replies, 3 voices, and was last updated 9 years, 9 months ago by Genesis Developer.
-
AuthorPosts
-
July 23, 2014 at 7:02 pm #115624hophead99Member
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/July 23, 2014 at 11:04 pm #115653essaysnarkParticipantThis sounds like a question for the ACF folks. Have you tried posting over there?
July 24, 2014 at 3:19 am #115667hophead99MemberHey
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
July 24, 2014 at 4:27 am #115669Genesis DeveloperMemberi 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>'; } }
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.