Created
October 16, 2020 18:52
-
-
Save djrmom/7cd4e3f10dfbbfa98e2abc9ad5f2087c to your computer and use it in GitHub Desktop.
facetwp fselect label
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
/** | |
* 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() { ?> | |
<script> | |
(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); | |
</script> | |
<?php }, 100 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment