Sort filter results by date in dropdown
-
I’m trying to have a drop down option in my filter bar to sort the results either by ASC or DESC.
I have this code which gives me the options in the form of radio buttons but I’m unable to change this code to give me the equivalent in drop down form:
add_filter('uwpqsf_form_bottom','injecting_buttons','',4); function injecting_buttons(){ echo '<div id="cmf_sort_by">'; echo '<input type="hidden" name="date" value="'.$taxname.'">'; echo '<input type="hidden" name="date" value="'.$opt.'">'; echo '<label><input '.$desc.' type="radio" id="taxhide" name="date" value="DESC"/>'.__("Sort By Newest","UWPQSF").'</label>'; echo '<label><input '.$asc.' type="radio" id="taxhide" name="date" value="ASC"/>'.__("Sort By Oldest","UWPQSF").'</label>'; echo '</div>'; } add_filter('uwpqsf_query_args','injecting_custom_arg','',4); function injecting_custom_arg($args, $id,$getdata){ $args['order'] = $getdata['date'];//likewise sort is the name of the order input. return $args; }
https://www.ads-software.com/plugins/ultimate-wp-query-search-filter/
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Sort filter results by date in dropdown’ is closed to new replies.