Skip Navigation

[Resolved] Showing data from a related post that is tied via other relationships

This thread is resolved. Here is a description of the problem and solution.

Problem:

I want to create a layout for a CPT for Suspensions. In the layout I want to show some data from related CPTs and their related CPTs.

Suspensions have a relationship to Access Cards. From here I have figured out how to get the Access Card # which is the title of the Access Card CPT.

Access cards have a relationship to Homeowners. From here I have figured out how to the Homeowners name which is the title if the Homeowner CPT.

Solution:

It needs nested view, see below document.

Relevant Documentation:

https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-fields-of-grandparents/

This support ticket is created 5 years, 5 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 6 replies, has 2 voices.

Last updated by larryB-3 5 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#1272107

Looking for some assistance determining which views/fields/queries I need to create to do the following.

I want to create a layout for a CPT for Suspensions. In the layout I want to show some data from related CPTs and their related CPTs.

Suspensions have a relationship to Access Cards. From here I have figured out how to get the Access Card # which is the title of the Access Card CPT.

Access cards have a relationship to Homeowners. From here I have figured out how to the Homeowners name which is the title if the Homeowner CPT.

Homeowners have a relationship to Properties. What I can’t figure out is how to display the title of the Property CPT associated with the Suspension/Access Card/Homeowner being displayed.

#1272177

Hello,

I assume we are talking about this case:
Four post types:
- Suspensions
- Access Cards, a post type relationship with "Suspensions"
- Homeowners, a post type relationship with "Access Cards"
- Properties, a post type relationship with "Homeowners"

If it is, I suggest you try to setup four level nested view, see our document:
Displaying Fields of Grandparents
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-fields-of-grandparents/

#1272659
Screen Shot 2019-06-19 at 9.00.14 AM.jpg
Screen Shot 2019-06-19 at 8.59.58 AM.jpg

Lou thank you! I'm getting close. I can now display the record (Suspension CPT), parent-record (Access Card CPT), and grand-parent-record (Homeowner CPT). I'm having problem displaying the great-grand-parent-record (Property CPT). I'm able to query and get a great-grand-parent record just not the related one.

#1273093

In your screenshot:
hidden link

section "Query Filter", there should be a post type relationship filter(between post types "Homeowners" and "Properties"), see our document:
Displaying many related items
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items

If you need assistance for it, please provide a test site with the same problem, I can setup a demo for you.

#1274037

Thanks for the details, checking it in your website, will update here if there is anything found

#1274057

I have done below modifications in your website:
1) Modify the post view "Access Cards with Suspensions Property Address":
hidden link
in section "Query Filter", change the filter from:
Select posts in a Properties Homeowners relationship that are a related to the post where this View is shown.
To:
Select posts in a Properties Homeowners relationship that are a related to the current post in the loop.

2) Edit the post view "access-card-user-name":
hidden link
in section "Loop item in Access Card User Name", display above views shortcode:

<hr />
Related properties
<hr />
[wpv-view name="access-cards-with-suspensions-property-address"]

Test it in front-end:
hidden link

I can see it works fine, please check if it is fixed, thanks

#1274503

My issue is resolved now. You guys rock!! Thank you!