Hi, I wonder if I can grab Infos of a relation of a relation in a view… and if so, how…
Example. I have a data model with a CPT „Shootings“ to which one or more CPT “Brands” are related. Each brand can be connected to one or more CPT “Sales Agents”.
Now I want to create a template to show a Shooting. At the end of the page I want to show logos of the Brand(a) which are in the shooting.
And in a widget I want to show the Sales Agents which are related to a Brand.
Any idea if this is possible and how?
Hello and thank you for contacting Toolset support.
That's totally possible, but you will need to use intermediate content templates or views. For 1-to-1 and 1-to-many relationships, you can get the child or the parent posts from the 1-to-1 content template directly through a shortcode by passing the correct item attribute. Read more about it here https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/
If you want to get the parent post in a 1-to-many relationship, you can do the same.
But for the related posts in a Many-to-many relationship or the child posts of a 1-to-many relationship, you will need a view.
When you are looking for a list of posts, you will always use a view. When you are looking for one post you can use a content template and the item attribute.
Now that you want to look for related posts of related posts, first, you will need to get the related posts, then through them with the same method, you will get their related posts.
I hope this makes sense? Let me know if you have any further questions, and let me know the nature of these relationships(1-to-1, 1-to-many, many-to-many)
My issue is resolved now. Thank you!