Hide template if no selections

<?php

// Add the code below

add_action( 'wp_head', function() {
?>
<script>
(function($) {
    $(document).on('facetwp-loaded', function() {
        if (FWP.loaded || '' != FWP.build_query_string()) {
            $('.facetwp-template').show();
        }
     });
})(jQuery);
</script>
<?php
}, 100 );