wordpress advanced custom fieds map with multiple locations
$15-40 USD
Kulipwa wakati wa kujifungua
I have created a google map that plots all the locations of my custom posts types on one map using the location field of the Advanced Custom Fields plugin.
My problem is that I can’t get it to pull any content or a link into the infowindow from those custom posts. Each marker needs to have the title, link and info from the custom fields appear when clicked. I also need it to change the marker depending on a true/false field.
This is the code I am using:
<section>
<?php
$args = array(
'post_type' => 'offices',
'posts_per_page' => -1
);
// query
$wp_query = new WP_Query( $args );
$NUM = 0;
?>
<div id="map"></div>
<script src='[url removed, login to view]' type='text/javascript'></script>
<script type="text/javascript">
var locations = [<?php while( $wp_query->have_posts() ){
$wp_query->the_post();
$location = get_field('location'); // IMPORTANT << Change this for your Google map field name !!!!!!
?>
['<?php the_title(); ?>', <?php echo $location['lat']; ?>, <?php echo $location['lng'];?>, <?php $NUM++ ?> ],
<?php } ?> ];
var map = new [url removed, login to view]([url removed, login to view]('map'), {
zoom: 7, /*Here you change zoom for your map*/
center: new [url removed, login to view](42.6, -76.0), /*Here you change center map first location*/
mapTypeId: [url removed, login to view]
});
var infowindow = new [url removed, login to view]();
var marker, i;
for (i = 0; i < [url removed, login to view]; i++) {
marker = new [url removed, login to view]({
position: new [url removed, login to view](locations[i][1], locations[i][2]),
map: map
});
[url removed, login to view](marker, 'click', (function(marker, i) {
return function() {
[url removed, login to view](locations[i][0]);
[url removed, login to view](map, marker);
}
})(marker, i));
}
</script>
</section>
Kitambulisho cha Mradi: #7580483
Kuhusu mradi
11 wafanyakazi huru wanazabuni wastani wa $83 kwa kazi hii
Dear Sir. We claim to get it done perfectly for you EXACTLY in the way you want it - Kindly give we a chance and we will prove myself - Ready to prove our words, let's get it done right away and I mean RIGHT AWAY !! Zaidi
hi sir thank for project i m very well experienced in word press designing and plug ins developing as well psd to wordpress i had done many fixes on the sites too i had developed plug ins like search , categories s Zaidi
Hello, I am a php coder and have worked with maps in WordPress environment. I can fix the code for you if you provide ftp or via skype. Let me know. Thanks Deb