Searching by date range
-
Hello. I′m trying to search by date range but it′s not working. Here is my code:
add_filter('uwpqsf_query_args','insert_date_to_query','',3); //if you are using default template, you will need to replace uwpqsf_query_args with uwpqsf_deftemp_query instead function insert_date_to_query($args,$id,$getdata){ $args['date_query'] = array( 'after' => strtotime($getdata['date']['from']), 'before' => strtotime($getdata['date']['to']), 'inclusive' => true ); return $args; } add_action('uwpqsf_form_bottom','insert_date_input'); function insert_date_input($attr){ $html = '<div class="uwpqsf_class">'; $html .= '<div><label><span>Desde <small>(fecha)</small></span> <input name="date[from]" value="" type="text" class="datep"></label></div>';//you can use select or other input type $html .='</div>'; $html .= '<div class="uwpqsf_class">'; $html .= '<div><label> <span>Hasta <small>(fecha)</small></span> <input name="date[to]" value="" type="text" class="datep"></label></div>'; $html .='</div>'; echo $html; }
It seems like filter “uwpqsf_query_args” is not working.
Thanks a lot!!
https://www.ads-software.com/plugins/ultimate-wp-query-search-filter/
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Searching by date range’ is closed to new replies.