<?php
// When there are no results, Bricks does not output the facetwp-template class, leading to empty facets
// Edit the page and open the query settings for the element where Use FacetWP is enabled.
// Scroll to the bottom of the query settings and add a text (not template) to display for No Results
// Then add the following snippet to your (child) theme's function.php
// Replace the id with the id of your Bricks element
// Note: this is not needed anymore in FacetWP 4.3.1+ which contains a fix.
add_filter( 'bricks/query/no_results_content', function( $content, $settings, $element_id ) {
if ( true == ( $settings["usingFacetWP"] ?? false ) ) {
$content = '<div id="brxe-olglkr" class="brxe-div facetwp-template">' . $content . '</div>';
}
return $content;
}, 10, 3 );