Open Street Maps Developer Filters

Filters for customising Open Street Maps. Add them to your theme's functions.php or a custom plugin.

Maps

Filter Use
epl_osm_tile_styles Add or change map styles in the Map Style setting. Each style has label, url, attribution, subdomains and optional api_key (the query parameter name for the Stadia key setting).
epl_osm_map_options All options passed to the map script: tile_url, attribution, subdomains, max_zoom, scroll_wheel, marker_icon, suburb_radius.
epl_osm_tile_url, epl_osm_tile_attribution, epl_osm_max_zoom Change one map option.
epl_osm_listing_map_args Map arguments for a listing (zoom, height, cord, q, suburb_mode). Receives the listing ID.
epl_osm_directions_url, epl_osm_directions_label Change the directions link.
epl_osm_admin_map_enabled Return false to keep the Easy Property Listings Google map on the listing edit screen.

Example: add a map style

add_filter( 'epl_osm_tile_styles', function ( $styles ) {
	$styles['my_style'] = array(
		'label'       => 'My Style',
		'url'         => 'https://tiles.example.com/{z}/{x}/{y}.png',
		'attribution' => '© Example, © OpenStreetMap contributors',
		'subdomains'  => '',
	);
	return $styles;
} );

Results maps

Filter Use
epl_osm_results_map_query_args WP_Query arguments for [listing_open_street_map_results]. Receives the shortcode attributes.
epl_osm_results_map_marker Marker data (lat, lng, title, price, url, image). Return false to leave a listing off the map.
epl_osm_results_map_hidden_statuses Statuses never shown on results maps. Default withdrawn and offmarket.
epl_osm_results_map_image_size Image size for the popup photo. Default epl-image-medium-crop.
epl_osm_archive_map_atts Shortcode attributes for the archive and search map.

Address lookup

Filter Use
epl_osm_geocode_url Lookup service search URL.
epl_osm_geocode_interval Seconds between lookups. Default 1, as required by the free service. Lower it only for a paid service that allows it.
epl_osm_listing_address, epl_osm_clean_address The address that's looked up.
epl_osm_address_variants Simpler versions of an address to try when it isn't found.
epl_osm_bulk_geocode_batch Listings per request in the dashboard bulk lookup. Default 5.

Shortcode and template functions

echo do_shortcode( '[listing_open_street_map id="123"]' );
echo epl_osm_results_map_shortcode( array( 'post_type' => 'rental' ) );

Map containers have the classes epl-osm-map (single) and epl-osm-results-map (results) for styling. Results popups use epl-osm-popup.