mogita
asked 8 years ago

Hi, I need to display the answers in a question by their votes count, thus the higher voted answers get displayed first, and when the votes are changed, the order changes too.
Is this possible with DW QA? Thank you!

1 Answers
Kevin
answered 8 years ago

Hi mogita,

Please add the code below to wp-content/themes/your-theme-folder/functions.php

add_filter( 'dwqa_prepare_answers', 'dwqa_theme_order_answer_vote' );
function dwqa_theme_order_answer_vote( $args ) {
	$args['orderby'] = 'meta_value_num id';
	$args['meta_key'] = '_dwqa_votes';
	$args['order']	= 'DESC';

	return $args;
}
mogita
replied 8 years ago

Thank you Kevin for such a fast response!
May I ask where should I find all available filters and such like “dwqa_prepare_answers”? I don’t see much detail in the “Support->Documentation” section. Anyway, thank you so much.

Kevin
replied 8 years ago

Hi Mogita,

We haven’t made the documentation for Developer yet, but we’re going to do it soon.

mogita
replied 8 years ago

Hi Kevin, thanks for the info!

Kevin
replied 8 years ago

You’re welcome, my friend. Let me know if there is anything else I can help you with.

mogita
replied 8 years ago

Yes there really is XD

I’m on a project that needs some customizations on DW QA, so if there’s a draft or some “alpha” versions of developer references, I’d like to get a copy, since the project is at hand and I found it hard to work all the way back to the plugin’s core codes.

If it’s not possible for now, I’ll still make my way thru the codes. XD
A big thanks in advance!

Kevin
replied 8 years ago

Hi Mogita,

You can contribute to the plugin with us on Github: https://github.com/designwall/dw-question-answer

pjeaje
replied 4 years ago

This hides the Sort By dropdown. Is there any way to list the answers by votes AND keep the Sort By dropdown box?

Powered by DW Question & Answer Pro