Plugin Author
TC.K
(@wp_dummy)
Yes, it is possible with the some hooks. But it is rather complicated.
Basically, you can add the extra sorting by using uwpqsf_form_bottom filter, and using uwpqsf_deftemp_query filter (for default search template) or uwpqsf_query_args to inject it into the search query.
How can I add the ASC and DSC order by date checkboxes to the Search Form on the page. I have the checkboxes there on the form, but how do I inject that input into the ajax search query?
Plugin Author
TC.K
(@wp_dummy)
You can inject it by using uwpqsf_query_args.
For eg.
add_filter('uwpqsf_query_args','injecting_custom_arg','',4);
function injecting_custom_arg($args, $id,$getdata){
//$getdata is the data from the form input. Using it like GET url parameter
$args['orderby'] = $getdata['orderby_name']; //if orderby_name is your input name.
$args['order'] = $getdata['sort'];//likewise sort is the name of the order input.
return $args;
}
Thank you for the help.
This is the code I ended up using to add two buttons: Sort By Newest and Sort By Oldest, that filter results by date to the search filter.
add_filter(‘uwpqsf_form_bottom’,’injecting_buttons’,”,4);
function injecting_buttons(){
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>
‘;
}
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;
}
Hi Csumrell,
How call this filter function in my custom page ,
///////////////////////////////////////////////////////
add_filter(‘uwpqsf_form_bottom’,’injecting_buttons’,”,4);
function injecting_buttons(){
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>
‘;
}
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;
}
//////////////////////////////////////////////////////////
Thanks,