Home › Forums › Front-end Issues › Accessing Relationship Field Values Within Relationship › Reply To: Accessing Relationship Field Values Within Relationship
Have you tried just getting the “location” field when looping through the “Producers”?
<h4>Transaction Contacts</h4> <?php $producers = get_field('transaction_contacts'); if($producers): ?> <ul class="list-unstyled"> <?php foreach( $producers as $p) : ?> <?php $office_location = get_field('office_locations', $p->ID); ?> <li> <p><?php echo get_the_title($p->ID); ?></p> <?php foreach( $office_location as $o) : ?> <p><?php echo get_the_title($o->ID); ?></p> <?php endforeach; ?> </li> <?php endforeach; ?> </ul> <?php endif; ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.