Support

Account

Home Forums ACF PRO How can I list all locations at one map

Helping

How can I list all locations at one map

  • Hi!

    I tried to list all locations from one custom post type at one map but it does not work properly.
    Is something like this possible?

    This is my code:

    <?php $the_query = new WP_Query( 'post_type=locations&posts_per_page=-1' ); ?>
    <?php if ( $the_query->have_posts() ) { ?>
    	<div class="acf-map">
    	<?php while ( $the_query->have_posts() ) { $the_query->the_post(); ?>
    
    		<?php $location = get_field('parking_location'); ?>
    		<div class="marker" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>"></div>
    
    	<?php } ?>
    	</div>
    
    <?php }  ?>

    *Actually this works just I didn’t had locations to all posts 🙂

  • There is some information on putting multiple markers on a map here http://www.advancedcustomfields.com/resources/google-map/. Most of the google map field for acf is do-it-yourself and you’ll need to search for information on the google map api.

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

The topic ‘How can I list all locations at one map’ is closed to new replies.