Adjusting the Default ‘Sort By’
Is there a way to disable the sort by -or- set the sort by to display ALL of the questions at once rather than only the actives?
Maciek Swoboda (Buyer) selected answer
Below code worked for me. By editing:
$args['sortby'] = 'voted';
you can change default sorting. The example shows sorting by votes:
<?php add_filter( 'ap_main_questions_args', 'wpdesk_ap_question_sort' ); /** * If filters and sorting are not set then sort questions by votes * */ function wpdesk_ap_question_sort( $args ) { if ( ! isset( $args['sortby'] ) && ! isset( $_GET['ap_filter'], $_GET['ap_filter']['sort'] ) ) { $args['sortby'] = 'voted'; } return $args; }
However this is probably not the proper approach to do it, because even when the questions are sorted by votes by default, in the sort dropdown it still shows sorting by “active”.
Probably Rahul or other developers will be able to provide a better solution.
Maciek Swoboda (Buyer) selected as best answer