The following code is working for me:
pronamic_google_maps(array(
'width' => 580 ,
'height' => 150 ,
'map_options' => array(
'minZoom' => 10 ,
'maxZoom' => 11 ,
'streetViewControl' => false
) ,
'marker_options' => array(
'icon' => 'http://google-maps-icons.googlecode.com/files/photo.png'
)
));
Maybe the link to your icon is not correct? You could use the get_stylesheet_directory_uri() function for an absolute URL to your theme.
if(function_exists('pronamic_google_maps')) {
pronamic_google_maps(array(
'width' => 290,
'height' => 200,
'static' => true,
'map_options' => array(
'mapTypeId' => 'map',
'zoom' => 10
),
'marker_options' => array(
'icon' => stylesheet_directory_uri() . '/path/to/map_icon.png'
)
));
}
Thread Starter
MattV
(@mattv)
Your first code snippet works, but only for dynamic Google Maps. When I add 'static' => true the custom icon is not shown anymore.
I had a look at the map image URL and it seems that the icon path is not passed to the markers parameter. Instead it shows the lat/long as value of the markers parameter.
My map:
http://maps.google.com/maps/api/staticmap?center=36.312416951469%2C126.51132056484&zoom=10&size=580x150&maptype=roadmap&sensor=false&markers=36.312416951469%2C126.51132056484
Working example of static map with custom icons:
http://maps.googleapis.com/maps/api/staticmap?size=480x480&markers=%20icon:http://chart.apis.google.com/chart?chst=d_map_pin_icon%26chld=cafe%257C996600%7C%20224+West+20th+Street+NY%7C75+9th+Ave+NY%7C700+E+9th+St+NY&sensor=true
Sorry i misunderstood, an custom icon on an static map was not supported. In the next release you can alse use an custom icon an static maps.
https://github.com/pronamic/wp-pronamic-google-maps/commit/819e9b8a3f2be93b73feb3993d470da1460a0264
Thread Starter
MattV
(@mattv)
That´s great! Thanks for your support.