FacetWP – index separate latitude and longitude fields

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

function index_latlng( $params, $class ) {
if ( ‘location’ == $params[‘facet_name’] ) {
$params[‘facet_value’] = get_field( ‘latitude’, (int) $params[‘post_id’] );
$params[‘facet_display_value’] = get_field( ‘longitude’, (int) $params[‘post_id’] );
}
return $params;
}
add_filter( ‘facetwp_index_row’, ‘index_latlng’, 10, 2 );
{{/gist}}