FacetWP: Sort by different criteria
-
Dear all,
I’m trying to add a sort option in my FacetWP that sorts results first by date (oldest post first) and then by a custom field I created called “Points”, that is always a number. I’m able to do it either/or, but I’m struggling to make both work simultaneosly. This is my code:add_filter( 'facetwp_sort_options', function( $options, $params ) { $options['points_desc'] = array( 'label' => 'Points (Highest)', 'query_args' => array( 'orderby' => 'meta_value_num', 'meta_key' => 'points', 'order' => 'DESC', ) ); return $options; }, 10, 2 );
I’m trying to replicate this here: GitHub, but I’m not being able to adapt it to my needs. Any help? Thanks in advance!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘FacetWP: Sort by different criteria’ is closed to new replies.