Support

Account

Home Forums ACF PRO Post Object not showing correct info

Solved

Post Object not showing correct info

  • 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>
    
  • Solved this, jQuery issue.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.