Shuffle Filter – add “Clear” button for checkboxes type

Content Views Pro helps you to show taxonomies as filter options easily. You can display these options in many type of output, one of them is checkboxes, which you can see the sample here.

To add “Clear All Filters” button before the filter bar, please:

  • Add this HTML before the View shortcode:
    <a href="#" class="clear-filter" id="clearFilters">Clear All Filters</a>
    [pt_view id="YOUR_VIEW_ID"]
    
  • Add this code to Custom JS field in Content Views >> Settings page:
    /* Shuffle Filter - add Clear button for checkboxes type */
    window.sf_enable_trigger = true;
    $('.clear-filter').on('click',function(e){e.preventDefault();
    var $last_checked = $('.pt-cv-filter-option.selected').last();
    $('.pt-cv-filter-option.selected').not($last_checked).removeClass('selected');
    $last_checked.trigger('click');
    });
    

Best regards,

Scroll to Top