Ordering depending on distance selection

mgibbs189

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

add_filter( ‘facetwp_query_args’, function( $query_args, $class ) {
if ( 0 < count( $class->facets[‘distance’][‘selected_values’] ) ) {
$query_args[‘orderby’] = ‘post__in’;
$query_args[‘order’] = ‘ASC’;
}
return $query_args;
}, 10, 2 );
{{/gist}}