Hello People.
I have a site that I am trying to paste multiple pins on a single map in a wordpress site, using cbxgooglemap plugin and advanced custom fields for my lat and long information.
The following code works fine for one pin, on one map.
echo do_shortcode('[cbxgooglemap lat="'.get_field('latitude').'" lng="'.get_field('longitude').'" ]');
However, when I try to post it within the loop, I simply get multiple maps, instead of one map, with multiple pins. Here is the code that doesn't work correctly, it gives me 3 maps.
<?php
$justMap = new WP_Query(array(
'posts_per_page'=> 3,
'post_type' => 'airfield_card'
));
while($justMap->have_posts()){
$justMap->the_post();
echo do_shortcode('[cbxgooglemap lat="'.get_field('latitude').'" lng="'.get_field('longitude').'" ]');
}
?>
Please can someone tell me how to alter the code so that a single map is outside the loop, but still embedding each pin from the loop.
Kind Regards
VinceGledhill