CPT Posts Grouped by Custom Taxonomy Terms in Bricks

A user asked via email:

I need some help with querying custom taxonomies in Bricks and I hope you could help me with that.

I have CPT created with Metabox called Services. I also created a custom taxonomy called Service Category.

I want to create a query that will first show all of the terms, and then inside this query there should be one more query, that will be querying through the services from this particular taxonomy.

Everything is working apart from the second inner query, I cannot get it to filter and show only services that are part of this current particular query, it is always showing all services, and I do not know how to solve this problem.

To give you some more context, here's the link showcasing how it should look like, I'm currently building it as a static page, as I did not find any other solution:

This Pro tutorial provides the steps to set up an outer Service Category terms loop and an inner Service posts loop in Bricks without writing a single line of code.

This works with posts of any post type and terms of any taxonomy incl. categories.

Step 1

Register your CPT and the associated custom taxonomy using Meta Box or ACF or CPT UI or otherwise.

CPT:

Custom Taxonomy:

Resave permalinks.

Step 2

Add posts of your CPT and select the corresponding terms for each.

Step 3

Create a template called say "Services" of the type Archive.

Edit it with Bricks.

Add a template condition to make it apply to your CPT archive page.

Copy the below JSON code and paste to import a Section having this structure:

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