ap_get_questions_orderby( string $current_url = '' )
Description #
Return all order by options for questions list.
Parameters #
- $current_urlstring (Optional) Current page URL. Default value: ''
Source #
File: includes/theme.php
function ap_get_questions_orderby( $current_url = '' ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found $param = array(); $search_q = get_query_var( 'ap_s' ); if ( ! empty( $search_q ) ) { $param['ap_s'] = $search_q; } $navs = array( array( 'key' => 'order_by', 'value' => 'active', 'label' => __( 'Active', 'anspress-question-answer' ), ), array( 'key' => 'order_by', 'value' => 'newest', 'label' => __( 'New', 'anspress-question-answer' ), ), ); if ( ! ap_opt( 'disable_voting_on_question' ) ) { $navs[] = array( 'key' => 'order_by', 'value' => 'voted', 'label' => __( 'Votes', 'anspress-question-answer' ), ); } $navs[] = array( 'key' => 'order_by', 'value' => 'answers', 'label' => __( 'Answers', 'anspress-question-answer' ), ); $navs[] = array( 'key' => 'order_by', 'value' => 'views', 'label' => __( 'Views', 'anspress-question-answer' ), ); $navs[] = array( 'key' => 'order_by', 'value' => 'solved', 'label' => __( 'Solved', 'anspress-question-answer' ), ); $navs[] = array( 'key' => 'order_by', 'value' => 'unanswered', 'label' => __( 'Unanswered', 'anspress-question-answer' ), ); $navs[] = array( 'key' => 'order_by', 'value' => 'unsolved', 'label' => __( 'Unsolved', 'anspress-question-answer' ), ); foreach ( (array) $navs as $k => $args ) { $active = ap_get_current_list_filters( 'order_by' ); if ( $active === $args['value'] ) { $navs[ $k ]['active'] = true; } } /** * Filter question sorting. * * @param array $navs Questions orderby list. * @since 2.3 */ return apply_filters( 'ap_questions_order_by', $navs ); }
Expand full source code Collapse full source code View on GitHub: includes/theme.php:391
How to remove unsolved filter option.
let me know
function remove_unsolved_filter( $navs ) {
$new = array();
foreach ( $navs as $key => $filter ) {
if( $filter[‘value’] != ‘unsolved’ ){
$new[] = $filter;
}
}
return $new;
}
add_filter( ‘ap_questions_order_by’, ‘remove_unsolved_filter’ );
Solved………………………………………………………………………………………………