Since: 3.2
File: includes/markers.php
Param: $markers Array of WPGeo_Marker objects
This filter is allows you to create and add a new marker icon.
Example
This example create a new marker icon that can be referenced as ‘my_large’.
function my_wpgeo_markers( $markers ) { $markers[] = new WPGeo_Marker( 'my_large', 'My Large Marker', 'This is my large marker image.', 44, 48, 10, 34, // width, height, anchorx, anchor y 'http://wordpress-30.local/wp-content/plugins/wp-geo-pplogo-marker/pp_logo.png', 'http://wordpress-30.local/wp-content/plugins/wp-geo-pplogo-marker/pp_logo.png' ); return $markers; } add_action( 'wpgeo_markers', 'my_wpgeo_markers' );
thank you for added me in wpgeo_markers.
I have succeeded adding a custom marker inserting this code in
/wp-content/plugins/wp-geo/includes/functions.php
The new marker appears in the drop-down menu in the post editor.
I am new to php and cannot think now of how to add 2 custom markers.
Could you give an example adding 2 custom markers / icons / pins ? It would be easy then to replicate the same logic (even for php illiterate people) to add 2, 3, or many more markers?
Thanks!
Wasn’t that hard finally, here the code to add two custom markers
function my_wpgeo_markers( $markers ) {
$markers[1] = new WPGeo_Marker(
‘my_large_test’,
‘JapaneseTemple’,
‘This is my large marker image test.’,
44, 48, 10,34, // width, height, anchorx, anchor y
‘http://yourwebsite/wp-content/plugins/wp-geo/customicon/japanese-temple.png',
‘http://yourwebsite/wp-content/plugins/wp-geo/customicon/japanese-temple.png‘
);
$markers[2] = new WPGeo_Marker(
‘my_large_test’,
‘Mountain’,
‘This is my large marker image test.’,
44, 48, 10,34, // width, height, anchorx, anchor y
‘http://gaijin-san.com/wp-content/plugins/wp-geo/customicon/japanese-temple.png',
‘http://gaijin-san.com/wp-content/plugins/wp-geo/customicon/japanese-temple.png‘
);
return $markers;
}
add_action( ‘wpgeo_markers’, ‘my_wpgeo_markers’ );
Added my own markers in directory customicon I created.
The drawback is that I think this customization would be deleted if the WP-geo plugin is updated.
Gaijin, You can put that code in your theme’s functions.php file so it doesn’t get overwritten when you upgrade the plugin.