Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active January 12, 2019 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/2e3e54c5400ea78608442482281780fb to your computer and use it in GitHub Desktop.
Save billerickson/2e3e54c5400ea78608442482281780fb to your computer and use it in GitHub Desktop.
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