Hide a reset button (.btn-reset) when no facets are in use

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

// Add to your (child) theme’s functions.php

add_action( ‘wp_head’, function() {
?>
<script>
(function($) {
$(document).on(‘facetwp-loaded’, function() {
var facets_in_use = (” != FWP.build_query_string());

// see https://api.jquery.com/toggle/
// TRUE to show, FALSE to hide
$(‘.btn-reset’).toggle(facets_in_use);
});
})(jQuery);
</script>
<?php
}, 100 );

{{/gist}}