Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * custom sort order for a facet, this orders by facet_display_value but facet_value could also be used
- **/
- add_filter( 'facetwp_facet_orderby', function( $orderby, $facet ) {
- if ( 'colors' == $facet['name'] ) { // change colors to the name of the facet
- $orderby = "FIELD(f.facet_display_value, 'Blue','Green','Red', 'Gray')";
- }
- return $orderby;
- }, 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement