• Resolved anjanphukan

    (@anjanphukan)


    Hi

    I have a list of taxonomies – ‘amenities’ as checkbox in the filter form. When user select multiple boxes they work with OR logic. I was wondering if it can be changed to AND logic.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author dgamoni

    (@dgamoni)

    Hi @anjanphukan

    AND logic available on Select Multiple type and Tokenize type

    Thread Starter anjanphukan

    (@anjanphukan)

    Hi @dgamoni

    Thanks for your reply. But that’s very unfortunate for me. I can only use Checkboxes here because of some specific requirements.

    By any chance, is there any hook or function to add this for the checkboxes?

    Regards
    Anjan

    Plugin Author dgamoni

    (@dgamoni)

    Hi @anjanphukan

    You can convert multiselect to checkbox via plugin
    https://github.com/nobleclem/jQuery-MultiSelect

    and you will have checkbox with logic AND

    1 disable ‘js Chosen’ on plugin settings


    2 register js jQuery-MultiSelect

    
    wp_enqueue_style('jquery-multiselect', 
      '/js/jquery-multiselect/jquery.multiselect.css'
    );
    
    wp_enqueue_script('jquery-multiselect-js',
      '/js/jquery-multiselect/jquery.multiselect.js'
    );


    3 add js

    $('select[multiple]').multiselect();
    
    // hide empty options
    $('.ms-options li').each(function(index, el) {
    var data_search_term = $(el).attr('data-search-term');
    	if ( data_search_term.length == 0) {
    		$(el).hide();
    	}
    });


    4 add css

    .ms-options-wrap button {
        display: none;
    }
    .ms-options-wrap  .ms-options {
        visibility: visible !important;
        min-height: inherit !important;
        max-height: inherit !important;
        border: none;
        position: relative;
    }

    demo

    Thread Starter anjanphukan

    (@anjanphukan)

    Hi @dgamoni

    Thank you so so much. I haven’t tried it yet. But I am expecting this to work. So I am marking this as resolved. Thanks again.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘‘AND’ logic for taxonomy checkboxes’ is closed to new replies.