Skip Navigation

[Resolved] Displaying post-relationship view

This support ticket is created 5 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 5 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#1167632

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.

#1168373

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