7th Jul '25
/
2 comments

How to hide Bricks Query Loop Posts until WP Grid Builder Facets are applied

Updated on 8 Jul 2025

In the unofficial Bricks Discord chat, a user asks:

I have a problem I need to solve, I need for this Bricks Query to show 0 result until someone use Facet filter on the left side from WP GridBuilder. I use ACF for custom post type. I try bunch of solutions but without success. Anyone has some tip ?

This Pro tutorial provides the steps to use custom JavaScript to hide the Bricks QL posts until there's an interaction by the user on the frontend like ticking a category or typing in a search facet when using WP Grid Builder.

We shall show a fallback div having "Use any filter to see the filtered posts." text initially on page load and whenever any applied facet has been cleared.

When not filtering:

After filtering:

When an applied filter is removed, the posts will be hidden and fallback shown.

Tested on these types of facets:

  • Search Field
  • Checkbox
  • Radio Button
  • Dropdown
  • Reset

Step 1

Set up a query loop in your Bricks template or a Page.

Section JSON for quick copy and paste. Note: ACSS classes and variables are used.

Make sure you create your facets first in WP Grid Builder. In the Facet elements (via the WPGB Bricks integration), select your facets and the query loop.

Query loop-enabled Block's parent's class is posts-grid__inner.

The Fallback Text has a class of fallback-text.

We will be referencing these in the JavaScript below.

Step 2

Create a file named say, wpgb-facet-hide-posts.js in your child theme's /assets/js path having:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 610 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
How to Limit a WP Grid Builder’s Term Grid to Only Current Post Terms

How to Limit a WP Grid Builder’s Term Grid to Only Current Post Terms

In the WP Grid Builder Facebook group (unofficial), a user asks: Hi All, I'm looking for a way to update the contents of a grid…
Categories:
Pro
How to Move an Element into Another on Smaller Viewports in Bricks

How to Move an Element into Another on Smaller Viewports in Bricks

This Pro tutorial provides the steps to move a Block containing a Heading and WP Grid Builder's Facet into BricksExtras' OffCanvas element for viewports 991px…
Pro
WP Grid Builder Filters inside Bricks’ OffCanvas

WP Grid Builder Filters inside Bricks’ OffCanvas

This Pro tutorial provides the steps to move WP Grid Builder's filters inside the Bricks' native Offcanvas on smaller viewport widths. Let's work with the…
Pro
Stock Quantity Block for WP Grid Builder

Stock Quantity Block for WP Grid Builder

In the unofficial WP Grid Builder Facebook group a user asked: Is it possible to show stock quantity on the card? I can't find it…
Categories: