facetwp index lat/lng

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php

function starkatcher_index_latlng( $params, $class ) {
if ( ‘location’ == $params[‘facet_name’] ) {
$latlong = explode(‘,’, get_post_meta( $params[‘post_id’], ‘sk-location’, true ));
$lat = $latlong[0];
$long = $latlong[1];

// foreach ( (array) $params[‘facet_value’] as $post ) {
$params[‘facet_value’] = $lat;
$params[‘facet_display_value’] = $long;
// }
}
return $params;
}
add_filter( ‘facetwp_index_row’, ‘starkatcher_index_latlng’, 10, 2 );
{{/gist}}