At Least 1 Search Result Condition in Bricks

This Pro tutorial shows how the new Element Conditions API added in Bricks builder v1.8.4 can be used to register a custom condition that enables us to render elements in the search results template depending on whether there is at least one search result or not.

Applying the condition on a Section that has a query loop for showing a grid of (matching) posts:

Applying the condition on a Section that should be output only when there are no search results:

Add the following in child theme's functions.php or a code snippets plugin:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Instant access to 390+ Bricks code tutorials with BricksLabs Pro