Created
May 9, 2016 17:41
-
-
Save mgibbs189/36a6036a0e3385f50b418d38e3e6e76b to your computer and use it in GitHub Desktop.
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 | |
// PUT THIS IN YOUR THEME'S FUNCTIONS.PHP | |
// Replace "my_facet" with your actual facet name | |
function facet_custom_sort( $orderby, $facet ) { | |
if ( 'my_facet' == $facet['name'] ) { | |
$orderby = 'FIELD(f.facet_display_value, "Under $50", "$50 - $75", "$75 - $100", "Over $100")'; | |
} | |
return $orderby; | |
} | |
add_filter( 'facetwp_facet_orderby', 'facet_custom_sort', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment