I need to fetch Top up voted posts

How to fetch the top up voted question posts from the Q/A plugin?

  • Mukund
    • Design Lord, Child of Thor

    We have fixed this issue. we have added this function in the function.php, and called the function in page.php

    function popular_questions() {
    global $post, $_qa_core;
    $had_action = false;
    $number = 5;
    $args = array( 'meta_key' => '_answer_count', 'orderby' => 'meta_value_num' );
    $args = array_merge( $args, array(
    'post_type' => 'question',
    'posts_per_page' => $number,
    'suppress_filters' => false
    ) );
    $tag_ids = array();
    if (isset($instance['tags']) && !empty($instance['tags'])) {
    $args['question_tag'] = $instance['tags'];
    }
    $cat_ids = array();
    if (isset($instance['categories']) && !empty($instance['categories'])) {
    $args['question_category'] = $instance['categories'];
    }
    echo '<div>';
    echo "<h3>Popular Questions</h3>";
    foreach ( get_posts( $args ) as $post ) {
    setup_postdata( $post );

    echo _qa_html( 'p', _qa_html( 'a', array( 'href' => get_permalink() ), get_the_title() ) );
    }
    echo '</div>';

    wp_reset_postdata();
    }

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.