-
-
Save billerickson/2e3e54c5400ea78608442482281780fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function($){ | |
// FacetWP Labels | |
// @see https://www.billerickson.net/advanced-search-with-searchwp-and-facetwp/#facetwp-labels | |
$(document).on('facetwp-loaded', function() { | |
$('.facetwp-facet').each(function() { | |
var $facet = $(this); | |
var facet_name = $facet.attr('data-name'); | |
var facet_label = FWP.settings.labels[facet_name]; | |
if ($facet.closest('.facet-wrap').length < 1) { | |
$facet.wrap('<div class="facet-wrap"></div>'); | |
$facet.before('<h5 class="facet-label">' + facet_label + '</h5>'); | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment