Map facet – dynamic icon based on an ACF field

mgibbs189

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

add_filter( ‘facetwp_map_marker_args’, function( $args, $post_id ) {
$field = get_field( ‘type_opport’, $post_id ); // Get this post’s ACF value
$icon = $field[0]; // get the first value (assuming this is an array)
$args[‘icon’] = ‘https://URL/TO/’ . $icon . ‘.png’;
return $args;
}, 10, 2 );

{{/gist}}