Skip to content

Instantly share code, notes, and snippets.

View gregBerthelot's full-sized avatar

Greg gregBerthelot

  • iPaoo
  • French Riviera Tech
View GitHub Profile
@remcokalf
remcokalf / facetwp 3.8+ dropdowns with chosen()
Last active July 29, 2022 15:18
Fixes for dropdowns facets and sortbox with .chosen() in FacetWP 3.8.0 - 3.8.2 because Facetwp fUtil library did not pick up jQuery.trigger change events from chosen() in these FacetWP versions. This was fixed in FacetWP 3.8.3+. Check this page for current versions of FacetWP: https://gist.facetwp.com/gist/use-chosen-js-with-facetwp-dropdowns-or…
(function ($) {
$(document).on('facetwp-loaded', function () {
// Facetwp Dropdowns to chosen dropdows
$('.facetwp-dropdown option:first-child').text('');
$('.facetwp-dropdown').attr('data-placeholder', 'All');
$('.facetwp-dropdown').chosen({disable_search_threshold: 50, allow_single_deselect: true});
// Facetwp Sort box to chosen dropdows