Terms Query in Bricks Filtered by Post Meta

Consider this scenario:

CPT: job
Taxonomy: industry
Custom field: job_visibility of type Radio with a default value of public. The other value is private.

Requirement: Show the industries associated with jobs for which job visibility is public.

This Pro tutorial shows how.

Let's look at this sample data:

After implementing the tutorial, the terms output will be Construction and Pharmaceutical.

"Job Fields" field group created with Meta Box (custom fields plugin does not matter for this tutorial, the same can be done with ACF as well):

Step 1

Enable query loop on a Block in the Bricks editor and select the query type of Terms.

Select your taxonomy.

Add a Heading or Basic Text element inside the query-loop Block having:

{term_name}

This will output all the terms of the selected taxonomy.

Step 2

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 525 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Primary Term for Posts using The SEO Framework in Bricks

Primary Term for Posts using The SEO Framework in Bricks

Updated on 18 Mar 2024 The SEO Framework is one of the better (coding-wise) SEO plugins. Like Yoast and Rank Math, it has the option…
Pro
aria-current=”true” for Current Categories on single Posts in Bricks

aria-current=”true” for Current Categories on single Posts in Bricks

How to separately style only the category links that are assigned to the current post.
Categories:
Pro
Filtering a Bricks Terms query on Term archive pages

Filtering a Bricks Terms query on Term archive pages

On product category archives, how to show product type names but only those that the current product category has.
Pro
Adding active class to the current term/post in a Bricks query loop on Term archives/single posts

Adding active class to the current term/post in a Bricks query loop on Term archives/single posts

Updated on 29 Feb 2024 In the Sibling Terms Bricks Query Loop tutorial, a member asked: How can I set the class "active" to the…
Categories:
Pro
Checking if the current term in a Bricks Terms query loop of the given taxonomy has children

Checking if the current term in a Bricks Terms query loop of the given taxonomy has children

There could be situations when you need a way to check if the current term in a Bricks Terms query loop has children or not.…
Categories:
Pro
Current Post’s Terms in Bricks

Current Post’s Terms in Bricks

Updated on 15 Jan 2024 This Pro tutorial provides the steps to set up a grid of terms (like categories) that the current post is…
Pro
Term Parent Slug Data Attribute in Bricks

Term Parent Slug Data Attribute in Bricks

How we can set a data attributes on a child taxonomy dynamically based on the parent taxonomy.
Categories: