I have been using the advanced custom fields plugin and very much appreciate its abilities.
I have a page on the website i'm working on called About Us and within that page, there is contained, a list of staff members (4 in total). I built this list of staff members using the add on repeater field in the advanced custom field plugin.
I am also developing a single page template devoted to information about the specialist industry area called "treatments", data is output from the main custom post loop of the same name. There are 4 individual custom post types containing this information.
Each member of staff is solely responsible for one of the four treatments. Therefore when a single page view of a specific treatment custom post data is output, I would like to append that information with the relevant staff member in charge of that treatment.
This code below grabs everything from the about us page template in this case using the page id of 89. Not quite what I am after as I need to take a particular row in page id 89 and see if that is a matching pair for the page being fed into the single-treatments.php page
The code is along the right lines however.
<?php $other_page = 89; ?> <?php if(get_field('about_the_practioner' , $other_page )): ?> <?php while(the_repeater_field('about_the_practioner' , $other_page)): ?> <h4><?php the_sub_field('header' )?><span><?php the_sub_field('title' )?></span></h4> <?php endwhile; ?> <?php endif; ?>
Is there a way of grabbing the relevant row data from the staff member repeater field depending on what treatment custom post has been fed into the single page template?