FacetWP – icon depending on taxonomy

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

add_filter( ‘facetwp_map_marker_args’, function( $args, $post_id ) {
$terms = wp_get_post_terms( $post_id, ‘age’ ); // assuming you have a custom taxonomy named “age”

foreach ( $terms as $term ) {
if ( ‘youth’ == $term->slug ) {
$args[‘icon’] = ‘https://URL/TO/marker1.png’;
}
elseif ( ‘middle-aged’ == $term->slug ) {
$args[‘icon’] = ‘https://URL/TO/marker2.png’;
}
elseif ( ‘old’ == $term->slug ) {
$args[‘icon’] = ‘https://URL/TO/marker3.png’;
}
}

return $args;
}, 10, 2 );
{{/gist}}