Last active
June 7, 2022 21:00
-
-
Save Mab213/5043987e304401831639953c2a354385 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_facetwp_index_row($params, $class) { | |
if ('branch' == $params['facet_name']) { | |
$values = (array) $params['facet_value']; // an array of post IDs (it's already unserialized) | |
foreach($values as $val) { | |
$params['facet_value'] = the_field('martygeocoderlatlng', $val); | |
$params['facet_display_value'] = the_field('martygeocoderaddress', $val); | |
$class -> insert($params); // insert each value to the database | |
} | |
// skip the default indexing query | |
return false; | |
} | |
return $params; | |
} | |
add_filter('facetwp_index_row', 'my_facetwp_index_row', 10, 2); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment