facetwp add tooltips to slider

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php
/** adds tooltips to slider handles
** https://refreshless.com/nouislider/slider-options/#section-tooltips
** note that you need an array even if you want true for both handles
**/

add_action( ‘wp_footer’, function() { ?>
<script>
(function($) {
if (‘object’ != typeof FWP) {
return;
}
FWP.hooks.addFilter(‘facetwp/set_options/slider’, function(opts, facet) {
if (facet.facet_name == ‘price’) {
opts.tooltips = [true,true];
return opts;
}
});
})(jQuery);
</script>
<?php }, 100 );

{{/gist}}