Skip to content

Instantly share code, notes, and snippets.

@ProjectKarol
Forked from mgibbs189/functions.php
Created December 9, 2018 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ProjectKarol/5dc9d698aa0abb73a599a4fd3f64c142 to your computer and use it in GitHub Desktop.
Save ProjectKarol/5dc9d698aa0abb73a599a4fd3f64c142 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