I have created a repeater field that lists the different countries, then a nested repeater that lists states or provinces for the country. Then inside that repeater, I have a post object set inside of a popup/modal, so when you click on the state it will show the correct team member for that state. I have the post object working but when I click on any State/Provence it lists the same person for everyone. In the WordPress admin, I have then all set to different people. What am I missing? The code is below if anyone can help.
<div class="inner-section">
<div class="dealersandreps-inner">
<?php if( have_rows('dealers_and_reps') ){ ?>
<?php while( have_rows('dealers_and_reps') ){ the_row();
$panel_title = get_sub_field('panel_title');
?>
<h4 class="accordion"><?php echo $panel_title; ?></h4>
<div class="panel">
<?php if( have_rows('location_inner') ) { ?>
<ul>
<?php while( have_rows('location_inner') ) { the_row();
$location = get_sub_field('location');
?>
<li class="open"><?php echo $location; ?></li>
<!--Creates the popup body-->
<div class="popup-overlay">
<!--Creates the popup content-->
<div class="popup-content">
<?php
$sales_person_object = get_sub_field('select_post_object');
if($sales_person_object){
//Fetch the image field from the carsandtrucks post
$image = get_field('team_image', $sales_person_object->ID);
$team_member_title = get_field('team_title', $sales_person_object->ID);
$phone = get_field('phone_number', $sales_person_object->ID);
$AAorT = get_field('company', $sales_person_object->ID);
$email = get_field('team_email', $sales_person_object->ID);
}
echo '<img src="' . $image . '" />';
echo '<h2>' . $team_member_title . '</h2>';
echo '<ul>';
echo '<li>' . $phone . '</li>';
echo '<li>' . $AAorT . '</li>';
echo '<li>' . $email . '</li>';
echo '</ul>';
?>
<!--popup's close button-->
<button class="close">Close</button>
</div>
</div>
<?php } ?>
<?php } ?>
</ul>
<?php } ?>
</div>
<?php } ?>
</div>
</div>
You must be logged in to reply to this topic.
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!
📣 “ACF Chat Fridays”
— Advanced Custom Fields (@wp_acf) January 31, 2023
The ACF team holds their first open office hours this Friday! Come and talk ACF, and ask questions about building sites with the plugin.
We’d love to see you there!
📆 Friday 3rd Feb - 3pm UTC
👉 Register here - https://t.co/3UtvQbE4CU pic.twitter.com/oTwW9K1XQ0
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.