Creating a Complex Relationship
-
Hi Konrad!
I’m working on a new site where I need to create a complex relationship between a “Show” custom post type and Users. In a normal situation, I would use your Bidirectional field (which is fantastic BTW!). However, this setup is a little more complex, so I’m hoping you can help in figuring out what the best option would be.
Every “Show” has a list of actors. The actors have to be ordered manually, based on how important their role was. So I was thinking that implementing a Flexible Content field would be a good fit for this as I could add as many actors as necessary for that show, and manually re-order them as needed. Now each “row” would have the actor’s name, but I’d love to turn this into a relationship field, linking to the User ID.
On the other end, on each User’s profile, I want to display all the shows that they have participated in. Initially, I thought that using the bidirectional field would be perfect for this. However, on the user profiles, I need to sort the Show post IDs by date of the show (which is another ACF field on the Show custom post type). So I’m wondering:
- Will the Bidirectional field even work inside a Flexible Content row?
- Is it better to make the Flexible Content rows use a non-bidirectional User relationship and then run a custom query on the User Profiles that tries to retrieve all the shows the user has been “tagged” in (similar to Example 4 on How to Query Posts using custom sub field values)?
- Is there an even better way to achieve all this?
Thanks a LOT for your help!
David
- The topic ‘Creating a Complex Relationship’ is closed to new replies.