facetwp fselect label

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
/**
* Use a default label in the open fselect dropdown different from the default shown when closed
* change facetwp-facet-product_categories to name of your facet and Custom Label to the label you want to use
**/
add_action( ‘wp_head’, function() { ?>

(function($) {
$(function() {
if (‘object’ !== typeof FWP) {
return;
}
FWP.hooks.addAction(‘facetwp/loaded’, function() {
console.log(‘test’);
$( ‘.facetwp-facet-product_categories .fs-option:first-of-type .fs-option-label’ ).text( ‘Custom Label’ );
}, 100 );
});
})(jQuery);

<?php }, 100 );
{{/gist}}