wordpress advanced custom fieds map with multiple locations

Anulowany Opublikowano Apr 30, 2015 Płatność przy odbiorze
Anulowany Płatność przy odbiorze

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>

Google Maps API WordPress

Numer ID Projektu: #7580483

O projekcie

11 ofert Zdalny projekt Aktywny Jun 2, 2015

11 freelancerów złożyło ofertę za $83 w tym projekcie

VnBestSolutions

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 !! Więcej

$141 USD w ciągu 3 dni
(25 Oceny)
5.4
doubledude

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 Więcej

$40 USD w ciągu 1 dnia
(1 Ocena)
4.0
deb4t1

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

$30 USD w ciągu 1 dnia
(1 Ocena)
1.4
deven19

Hello, I am Devendra Chauhan specializing in software product development, and technology research and development (R&D) services, I have 4+ year of experience in Web Design and Development, I have 10 member team wh Więcej

$77 USD w ciągu 3 dni
(0 Oceny)
0.0