facetwp empty facet add text

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php
/** check facets and add a message if empty **/
add_action( ‘wp_head’, function() { ?>
<script>
(function($) {
$(function() {
FWP.hooks.addAction(‘facetwp/loaded’, function() {
$(‘.facetwp-facet’).each(function() {
var content = $(this).html();
if (” == content) {
$(this).append(“No Results”);
}
});
}, 1000 );
});
})(jQuery);
</script>
<?php }, 100 );
{{/gist}}