Home › Forums › MapPress Support › Changed API > Need Mashup based on custom fields › Reply To: Changed API > Need Mashup based on custom fields
August 26, 2022 at 12:44 pm
#19625
Hi,
I think it would be easier to just let MapPress generate the necessary maps, and use a mashup block to display them. You could then use the standard filtering/query by post type & taxonomies.
But if you’d like to use the filter, the example code below worked for me (I added it to the theme’s ‘functions.php’).
function myfilter($map, $args) {
$poi = new Mappress_Poi(array('title' => 'mypoi', 'point' => ['lat' => 22, 'lng' => 23]));
$map->pois = [$poi];
return $map;
}
add_filter('mappress_post_query', 'myfilter', 10, 2);
You can also use filter ‘mappress_query_pois’ which just replaces the POIs. There’s an example of using that filter in ‘mappress_frontend.php’, which fetches POIs from data stored in the Advanced Custom Fields plugin.
