Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Created February 16, 2018 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mgibbs189/2372351f34cd7d19d87743716ae23343 to your computer and use it in GitHub Desktop.
Save mgibbs189/2372351f34cd7d19d87743716ae23343 to your computer and use it in GitHub Desktop.
Map facet - dynamic icon based on an ACF field
<?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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment