Support

Account

Home Forums General Issues Multiple Google Map Marker Icons Reply To: Multiple Google Map Marker Icons

  • Hi @atmacmillan

    What do you mean by unsolve?

    The way I would do this is use the code found in the documentation here:
    http://www.advancedcustomfields.com/resources/google-map/

    And to add support for your custom icons you can add a third data parameter to the marker div:

    
    <div class="marker" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>" data-icon="<?php echo $image['url']; ?>"></div>
    

    And in the JS function for the markers:

    
    // var
    	var latlng = new google.maps.LatLng( $marker.attr('data-lat'), $marker.attr('data-lng') );
    
    	var icon = $marker.attr('data-icon');
    	// create marker
    	var marker = new google.maps.Marker({
    		position	: latlng,
    		map			: map,
    		icon		: icon
    	});