Skip to content

Instantly share code, notes, and snippets.

@Mab213
Last active June 7, 2022 21:00
Show Gist options
  • Save Mab213/5043987e304401831639953c2a354385 to your computer and use it in GitHub Desktop.
Save Mab213/5043987e304401831639953c2a354385 to your computer and use it in GitHub Desktop.
<?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