Code Snippets

Custom Map Marker

add_filter( 'facetwp_leaflet_map_marker_args', function( $args, $post_id ) {
	/**
	 * Value of $args['icon'] is passed to L.icon
	 * 
	 * @see Leaflet docs https://leafletjs.com/reference.html#icon
	 */
	$args[ 'icon' ] = [
		'iconUrl' => 'https://facet-leaflet.test/wp-content/uploads/2023/01/marker-icon.png',
		'shadowUrl' => 'https://facet-leaflet.test/wp-content/uploads/2023/01/marker-shadow.png',
		'iconSize' => [25, 41],
		'iconAnchor' => [12, 41],
		'popupAnchor' => [1, -34],
		'shadowSize' => [41, 41]
	];

	return $args;
}, 10, 2 );

Overwrite cluster args

/**
 * Overwrite cluster args
 * 
 * @see Options https://github.com/Leaflet/Leaflet.markercluster#options
 */
add_filter( 'facetwp_leaflet_map_cluster_args', function( $cluster_args ) {

	$cluster_args[ 'showCoverageOnHover' ] = true;

	return $cluster_args;
} );