facetwp facet orderby combine rules with FIELD

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php
/** multiple facetwp_facet_orderby rules **/
add_filter( ‘facetwp_facet_orderby’, function( $orderby, $facet ) {
if ( ‘source’ == $facet[‘name’] ) {
$orderby = ‘FIELD( f.facet_display_value, “Second Value in Dropdown”, “First Value in Dropdown” ) DESC, f.facet_display_value ASC’;
}
return $orderby;
}, 11, 2 );
{{/gist}}