WordPress.org

Support

Support » Plugins and Hacks » Ajax WP Query Search Filter » Multiple Select as Display Type

Multiple Select as Display Type

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TC.K

    @wp_dummy

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

    eg

    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.

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

    Hello

    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?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multiple Select as Display Type’ is closed to new replies.
Skip to toolbar