Is there a way of changing the default pin graphic, what I need to is change the graphic between 2 versions depending on what type of location it is.
I can change it across all locations but i need to be per location.
Would be cool if this could be done in the ‘data’ attributes when you add markers.
http://www.tlccarehomes.co.uk/our-services/map/
Many thanks
neil
Just sorted it, I really love this plugin.
Here is my add_marker() function:
function add_marker( $marker, map ) {
var iconBase = '<?php echo get_bloginfo('template_directory') ;?>/images/';
// var
var latlng = new google.maps.LatLng( $marker.attr('data-lat'), $marker.attr('data-lng') );
// create marker
var marker = new google.maps.Marker({
position : latlng,
map : map,
icon: iconBase + $marker.attr('data-pin') + '-pin.png'
});
// add to array
map.markers.push( marker );
// if marker contains HTML, add it to an infoWindow
if( $marker.html() )
{
// create info window
var infowindow = new google.maps.InfoWindow({
content : $marker.html()
});
// show info window when marker is clicked
google.maps.event.addListener(marker, 'click', function() {
infowindow.open( map, marker );
});
}
}
“data-pin” comes from a data element generated by WordPress category.
Hope that helps.
neil