'main_questions', 'post_type' => 'question', 'post_status' => 'publish', 'showposts' => ap_opt('question_per_page'), ); if($order == 'active'){ $question_args['ap_query'] = 'main_questions_active'; $question_args['orderby'] = 'meta_value'; $question_args['meta_key'] = ANSPRESS_UPDATED_META; $question_args['meta_query'] = array( 'relation' => 'OR', array( 'key' => ANSPRESS_UPDATED_META, 'compare' => 'NOT EXISTS', ), ); }elseif($order == 'voted'){ $question_args['orderby'] = 'meta_value_num'; $question_args['meta_key'] = ANSPRESS_VOTE_META; }elseif($order == 'answers'){ $question_args['orderby'] = 'meta_value_num'; $question_args['meta_key'] = ANSPRESS_ANS_META; }elseif($order == 'unanswered'){ $question_args['orderby'] = 'meta_value'; $question_args['meta_key'] = ANSPRESS_ANS_META; $question_args['meta_value'] = '0'; }elseif($order == 'oldest'){ $question_args['orderby'] = 'date'; $question_args['order'] = 'ASC'; } if ($label != ''){ $question_args['tax_query'] = array( array( 'taxonomy' => 'question_label', 'field' => 'slug', 'terms' => $label ) ); } $question = new WP_Query( $question_args ); include ap_get_theme_location('questions-widget.php'); echo $args['after_widget']; wp_reset_postdata(); } public function form( $instance ) { $title = __( 'Questions', 'ap' ); $avatar = 30; $show_selected = false; $show_activity = true; $show_answers = true; $show_vote = false; $show_views = false; $show_category = false; $show_tags = false; $order = 'active'; $label = ''; if ( isset( $instance[ 'title' ] ) ) $title = $instance[ 'title' ]; if ( isset( $instance[ 'avatar' ] ) ) $avatar = $instance[ 'avatar' ]; if ( isset( $instance[ 'show_selected' ] ) ) $show_selected = $instance[ 'show_selected' ]; if ( isset( $instance[ 'show_activity' ] ) ) $show_activity = $instance[ 'show_activity' ]; if ( isset( $instance[ 'show_vote' ] ) ) $show_vote = $instance[ 'show_vote' ]; if ( isset( $instance[ 'show_category' ] ) ) $show_category = $instance[ 'show_category' ]; if ( isset( $instance[ 'show_answers' ] ) ) $show_answers = $instance[ 'show_answers' ]; if ( isset( $instance[ 'show_tags' ] ) ) $show_tags = $instance[ 'show_tags' ]; if ( isset( $instance[ 'order' ] ) ) $order = $instance[ 'order' ]; if ( isset( $instance[ 'label' ] ) ) $label = $instance[ 'label' ]; ?>
>
>
>
>
>
>
>