This Pro tutorial provides the steps to set up a dynamic accordion of posts grouped by their categories based on the previous Posts Grouped by Categories in Bricks tutorial.
We are going to set up two query loops inside an Accordion (Nestable) Bricks element - one inside the other. The outer one loops through terms and the inner one through posts. We shall then write a bit of code using the bricks/posts/query_vars
filter hook to restrict or limit the posts in the inner loop to only those assigned to the outer loop's current category.
Remember that this can be applied to posts of any post type grouped by a corresponding taxonomy (built-in or custom) and is not limited to just posts and categories.
Step 1
Copy and paste the entire Section from our test site in your Page/template (when editing with Bricks) using the Section's JSON from the link below.
This is a BricksLabs Pro tutorial.
For full access login below or create your BricksLabs Pro account