Forked from anonymous/Ordering depending on distance selection
Last active
August 14, 2017 13:03
-
-
Save mgibbs189/4970194412173dd0152293661ad9d2b9 to your computer and use it in GitHub Desktop.
Ordering depending on distance selection
This file contains 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 | |
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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment