Support

Account

Home Forums ACF PRO Multiple queries single page (map markers) Reply To: Multiple queries single page (map markers)

  • Hi @rickblackdog

    I believe that is because you were trying to get the location outside the loop. Could you please move it into the loop like this:

    <?php 
    
    $args = array( 'post_type' => 'members', 'posts_per_page' => -1 );
    $loop = new WP_Query( $args ); 
        
    while ( $loop->have_posts() ) : $loop->the_post(); ?>
    
        <?php $location = get_field('location'); ?>
        <div class="marker" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>"></div>
        
    <?php endwhile; ?>

    I hope this helps 🙂