→ Add labels above each facet

FacetWP does not automatically outputĀ facet labels. However, it’s possible to add them programmatically using a bit of custom javascript code.

function fwp_add_facet_labels() {
?>
<script>
(function($) {
    $(document).on('facetwp-loaded', function() {
        $('.facetwp-facet').each(function() {
            var facet_name = $(this).attr('data-name');
            var facet_label = FWP.settings.labels[facet_name];
            if ($('.facet-label[data-for="' + facet_name + '"]').length < 1) {
                $(this).before('<h3 class="facet-label" data-for="' + facet_name + '">' + facet_label + '</h3>');
            }
        });
    });
})(jQuery);
</script>
<?php
}
add_action( 'wp_head', 'fwp_add_facet_labels', 100 );

Add this code to your (child) theme’s functions.php, or into a custom plugin.