OK I set one CPT “composer” with only Post title field. Second CPT “song” with Post title field + one relationship field “autor” that looks to composer title field. I can’t figure out how to set nested loops at Bricks. On first container I use query to “composer” and after that H2 text with dynamic data {post_title}, that works ok. Then I need another container with query for all songs that are with relationship to single composer. Can’t find any documentation or instructions for this. I can see “ACF Relationship: Autor” at query Type list, but don’t understant logic how can I use it. I need list all songs under each Author from first query that belongs to this Author only. Maybe all my logic at settings ACF + CPTs relatinship is bad. I’m stuck. Thanx for help.
Hi
you have to use 2 loops, for example like this:
In the first loop, you query the CPT so that in your case all composers are found:
Then below that you add another loop where you select the ACF relationship (Bricks shows you the found ACF relationships), in your case autor:
This is then the result:
Cheers
Patric
Can it be that you did not create a relationship field in the composer CPT?
In the composer CPT create a relationship field and make sure that in this ACF relationship field you have these settings, i.e. Bidirectional is on and the correct ACF relationshipfield (in your case autor!) is in the target field:
In the song CPT and the autor relationship field, make sure to also have the corrsponding settings, i.e. bidirectional and the target points to the relationship field of the composer CPT.
These settings will give you a full bidirectional relationship, meaning when you create a new composer, you can add directly there the songs and the field autor in the song CPT will be updated automatically.
OK I added relationship field to CPT “composer” too and make both bidirectional. First loop is working (it was working before the same way), second still with no results.
Structure + first query:
Sorry with {post_title} at second query it works. Cant figure out why is bidirectional needed. There must be a way to query only with one relationship field (autor inside CPT songs)
Bidi just makes the updates easy and automatic… you can assign the songs directly in the composer CPT without having to assign in the songs each autor…
For just an acf relationship, see this:
Bidi gives you much more power to query the dynamic fields… so I always use them because many times, later down the road, I needed its functionality and I was glad it was already activated.
I didn’t want to have to updated hundreds of posts…
And you can query the songs and directly show the Autor coming from the bidi-relationship field as this information is now also there.
Thanx a lot Patric. Realy helpfull.