Hi there
We have 3 custom post types: clients, case studies and packages. One client can have many case studies and many packages associated with it. A case study can only be associated with one package and one client.
On our single case study page (hidden link) we want to display the other case studies associated with this client (see the heading "Read other case studies for this client").
We've created a view called "case-studies-by-client-view" and filtered by the "Clients Case Studies" relationship, but nothing is being displayed, even though there are multiple case studies assigned to this client. You can see the Clients Case Studies relationship for this client (The Yoga Spot) here: hidden link.
Can you help?
Thanks.
Hello,
How do you setup the post type relationships?
I assume we are talking about this case:
- One to many relationship between post types "clients" and "case studies", for example, the relationship slug is "clients-case-studies"
- In a single "case studies" post, you are going to display other "case studies" posts related with parent "clients" posts.
If it is, it is possible within Views plugin.
You can try these:
1) Create a post view "brother-case-studies":
- query "case studies" posts
- filter by :
Select posts in a clients-case-studies relationship that are a related to the current post in the loop.
- in view's loop, display the "case studies" posts information
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items
2) Create a content template "parent-clients-information", display above view's shortcode, like this:
[wpv-view name="brother-case-studies"]
3) Put above content template into the single "case studies" post content, like this:
[wpv-post-body view_template="parent-clients-information" item="@clients-case-studies.parent"]
More help:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-related-child-posts/
Displaying Related Child Posts