Chris Arnold
asked 2 years ago

I searched the forums, but couldn’t find an answer to this question.  It may be more of a feature request too.
1) After selecting sort (by views, answers, or votes) on the main questions page, how can you clear the sort without refreshing the page?
2) Can you sort by date?
3) Questions that a zero value for the view, answer, or vote are filtered out on those respective sorts…is there a way to always display these on the bottom below the sorted with-numeric values?
Thanks much!

2 Answers
DominicStaff
answered 2 years ago

At the moment, the plugin does not support these options. We have noted and sent to our technical team about it. We will discuss about it. 

carnold437
answered 2 years ago

Here is the solution…
2) To sort by date simply add the below line of code after the “Sort by” option menu item…

<option <?php selected( $sort, 'date' ) ?> value="<?php echo esc_url( add_query_arg( array( 'date' => 'views' ) ) ) ?>"><?php _e( 'Date', 'dwqa' ) ?></option>

Optionally, remove the selected from <option selected disabled> and add selected=”selected” after “<option” above to have Date selected by default. Afterall, it already loads by default anyway!
2-b) For a further design change, I much prefer that the selected value is visible without clicking on the dropdown.  I’m using the flat template, so I deleted the dwqa-sort-by class in the template and wrote my own.
1) No longer need to clear sort as all sort options are covered, so you can easily return the default view.
3) My zero value filtering issue auto-magically resolved.  So not an issue anymore!

Dominic Staff
replied 2 years ago

I loved you. 😀
Thank for your help Carnold. We appreciate all your answers.

Powered by DW Question & Answer Pro