In most of the previous tutorials covering nested query loops in Bricks on this site, we accessed the parent query's looping object in the inner query loop using one of the two methods shared in Parent Query Loop Object - Traversing Nested Query Loops Up in Bricks. Typically we will have a custom criterion for the outer query and the inner would be the posts query.
There's a slightly better way of going about the nested query loops and this Pro tutorial shows how a custom query type can be created for the inner query loop (in addition to the one for outer QL) that accesses the parent query's loop object in the code outside the Bricks editor. This makes it simpler to implement the nested queries in the Bricks editor wherein we just have to select the custom query type rather than having to specify the outer query loop-enabled element's Bricks ID.
The steps can be outlined like this:
This is a BricksLabs Pro tutorial.
For full access login below or create your BricksLabs Pro account