benhuson / WP-Geo

WP Geo is a location plugin for WordPress that uses Google Maps. Current stable version can be downloaded from WordPress Extend.
https://wordpress.org/plugins/wp-geo/
25 stars 18 forks source link

additional parameters to wpgeo_map_js_preoverlays? #67

Open titaniumbones opened 9 years ago

titaniumbones commented 9 years ago

Hi,

Is it possible to add additional parameters to functions added to the wpgeo_map_js_preoverlays hook?

I would like to permit different maps to have different image overlays; ideally, these could be added to the shortcode. If it's not possible though I can figure out something else. thanks, Matt

benhuson commented 9 years ago

I don't think it's possible to pass through from the short code to that point at present.

I could possibly add an additional parameter to wpgeo_map_js_preoverlays for the main map object... e.g.

apply_filters( 'wpgeo_map_js_preoverlays', '', $map->get_js_id(), $map )

This would give you access to the Map object. Would that help?

The adjustment would have to be made in the two api files.

A map can have multiple markers (posts) so you would have to loop through to find the one you want or simply grab the first one:

$point = $map->get_point(0);

Then I think (it's been a long time since I looked at it) that you can get the post relating to the point.

$post = $point->get_arg( 'post' );