facetwp test for single slider result

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php
/** adds js to detect when a single option is hiding slider
** modify ln 10 however need to represent slider in this condition
** for example, you could add an image of a blank slider
**/
add_action( ‘wp_footer’, function() { ?>
<script>
(function($) {
$(document).on(‘facetwp-loaded’, function() {
if ( $(‘.facetwp-slider’).html().length < 1 ) {
$(‘.facetwp-slider’).html(‘<p>Single Result</p>’); // add html or css or other JS here
}
});
})(jQuery);
</script>
<?php }, 100 );
{{/gist}}