20th Mar '24
/
0 comments

Prefiltering Bricks Terms Query Loop

Let's say there's a Events CPT with a 'Event Year' custom taxonomy.

Sample event year names could be: 2021, 2022, 2024, 2025, 2028 etc.

We can set up a Terms query in Bricks to output these terms.

Result:

The reason 2021 is not present is because there are no posts that have been categorized with 2021.

Now the requirement is to output only the (non-empty) years that are in the future.

Like this:

This Pro tutorial shows how terms can be filtered based on their value using the bricks/terms/query_vars filter.

Add the following in child theme's functions.php (w/o the opening PHP tag) or a code snippets plugin:

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
Conditionally Hiding Bricks Filters based on Select Filter Value

Conditionally Hiding Bricks Filters based on Select Filter Value

How show or hide Bricks' filter based on the selection made by another filter.
Categories:
Tags:
How to create filters with IsotopeJS in Bricks (Part 4): AJAX filter and infinite loops, Sorting, List view and Disable animations

How to create filters with IsotopeJS in Bricks (Part 4): AJAX filter and infinite loops, Sorting, List view and Disable animations

This tutorial will explain how to enable the AJAX filter with an infinite scroll query loop container, how to add a sorting function, how to…
Categories: