VinceGledhill Posted July 8, 2020 Share Posted July 8, 2020 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 Quote Link to comment https://forums.phpfreaks.com/topic/311052-php-in-wp-loop-problem/ Share on other sites More sharing options...
maxxd Posted July 8, 2020 Share Posted July 8, 2020 The pro paid version supports this, the free doesn't. If you've paid for the plugin you should also have customer support information and I'd venture to say that's probably the best place to start. Quote Link to comment https://forums.phpfreaks.com/topic/311052-php-in-wp-loop-problem/#findComment-1579447 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.