How to Hide Empty Facets
Using some JavaScript, you can hide facets that contain no values. In this example, each of our facets is contained within an element having the class of facet-wrap.
<script> (function($) { document.addEventListener('facetwp-loaded', function() { $.each(FWP.settings.num_choices, function(key, val) { var $parent = $('.facetwp-facet-' + key).closest('.facet-wrap'); (0 === val) ? $parent.hide() : $parent.show(); }); }); })(jQuery); </script>
Place this code into your theme’s header.php or (better yet) into a custom javascript file.