I want to display answers by votes (top voted on top and then newest answers with no votes).
I have added the following meta key and order (in my dwqa-templates/answers.php), but it only works if answer has at least one vote.
'meta_key' => '_dwqa_votes',
'orderby' => 'meta_value_num',
$args = array(
'post_type' => 'dwqa-answer',
'posts_per_page' => -1,
'order' => 'DESC',
'meta_key' => '_dwqa_votes',
'orderby' => 'meta_value_num',
'meta_query' => array(
array(
'key' => '_question',
'value' => array( $question_id ),
'compare' => 'IN',
)
),
'post_status' => $status
);
Can you help me to solve this problem? I’m just a beginner.
1 Answers
Thats a good dig, Billy!
I will see if I can test it out on my end. and any help from DW team would be appreciated.
Please login or Register to submit your answer
replied 6 years ago
Can you tell me how to do this please? Do I just copy and paste this into the answers.php file directly?