Ajax WP Query Search Filter
Multiple Select as Display Type (4 posts)

  1. Aldo
    Posted 2 years ago #


    Would it be possible to add a Multiple Select as display type for taxonomies, and so on to optimize the search form size with large selection options?



  2. TC.K
    Plugin Author

    Posted 2 years ago #

    Yes, you can. You can change your checkbox in order to do this. There is a filter for this: ajwpqs_tax_field_checkbox()


    add_filter('ajwpqs_tax_field_checkbox', 'custom_checkbox_field','',9);
    function test_field_5($html,$type,$exc,$hide,$taxname,$taxlabel,$taxall,$c,$divclass){
    	//here you can customize your checkboxes.

    Frankly, it is not easy to use this filter, if you are not familiar with those parameters, you can refer to /classes/ajwpqsf-misc-class.php and look for function output_formtaxo_fields to see how to use it.

  3. Aldo
    Posted 2 years ago #

    Thanks, worked perfectly.
    Maybe as Feature request if you would add multiselect as possible display type, would be great ;-)

  4. Aldo
    Posted 2 years ago #


    Just realized, that my code does not the job as the checkboxes.

    I use this code to create a multiselect list:

    add_filter('ajwpqs_tax_field_checkbox', 'custom_checkbox_field','',9);
    function custom_checkbox_field($html,$type,$exc,$hide,$taxname,$taxlabel,$taxall,$c,$divclass){
    	//here you can customize your checkboxes.
    	$eid = explode(",", $exc);
    		$args = array('hide_empty'=>$hide,'exclude'=>$eid );
            $terms = get_terms($taxname,$args);
    		$html  = '<div class="'.$divclass.' taxdropdown-'.$c.'"><label class="tax-label-'.$c.'">'.$taxlabel.'</label>';
    		$html .= '<input  type="hidden" name="taxo['.$c.'][name]" value="'.$taxname.'">';
    		$html .=  '<select id="taxselect-'.$c.'" name="taxo['.$c.'][term]" multiple class="chosen chzn-select"><option selected value="awpqsftaxoall">'.$taxall.'</option>'; 
    					foreach ( $terms as $term ) {
    						$html .= '<option value="'.$term->slug.'">'.$term->name.'</option>';
    				$html .= '</select><br>';
    				$html .= '</div>';
    				return $html;

    Unfortunately the first selection gets only to the search query. What else is needed, so your code picks up all the selected terms in the multiselect list?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Ajax WP Query Search Filter
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.