facetwp customizing map

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php

/** filtering map styles, this will add rules to the default or your choosen style setting
* in the map facet settings
** see https://developers.google.com/maps/documentation/javascript/style-reference
*/
add_filter( ‘facetwp_map_init_args’, function( $settings) {

if ( !isset( $settings[‘init’][‘styles’] ) ) return $settings; // return if styles isn’t in the settings

if ( empty( $settings[‘init’][‘styles’] ) ) {
$settings[‘init’][‘styles’] = array(); // make sure styles is an array so we can add to it
}

$settings[‘init’][‘styles’][] = (object) array( ‘featureType’ => ‘poi’, ‘stylers’ => array( (object) array( ‘visibility’ => ‘off’) ) ); // disable display of poi

return $settings;
});
{{/gist}}