Skip Navigation

[Resolved] Display Children at Grandparent level

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

Problem:
Display Children at Grandparent level

Solution:
You need to create a nested view to loop through each level of your relationship and filter the view by the required relationship.

You can find the proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/display-children-at-grandparent-level/#post-1174113

Relevant Documentation:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-related-child-posts/

This support ticket is created 6 years 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 7 replies, has 2 voices.

Last updated by arvidB 6 years ago.

Assisted by: Minesh.

Author
Posts
#1173641

Tell us what you are trying to do?
I have a site in which I have three custom post types:
- Resort
- Park
- Event

There are relationships between:
- Resort to park: one-to-many
-Park to event: many-many

Now I can show events at Park level, but I also would like to show events on Resort level. I can only find documentation to display grandparents fields on child level, or display related child posts.

Is there any documentation that you are following?
https://toolset.com/forums/topic/how-to-see-grandchild-custom-post-with-information-of-his-parent-and-grandparent/
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-related-child-posts/

Is there a similar example that we can see?

What is the link to your site?

#1174066

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - to display the information of grandparents, Please check the following latest Doc for more information:
=> https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-fields-of-grandparents/

#1174071

Hi Minesh,

That is actually not what I'm trying to accomplish. I'm trying to display children at the level of grandparents. In the example that I have, I have an event that I can show at a park (parent), but now I also want to show it at a resort post.

#1174076

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

ahh Ok, I understand now. You want to display the grandchild information. It will be more helpful to me if you can share problem URL and details what fields you want to display from what post type?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#1174113

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok - thank you for sharing all required details.

could you please check now:
=> hidden link

We need to use the nested views to fetch the related parks and based on parks the related events belongs to parks.

I've added the following view namely "display-events-on-resort-single" that will loop through the Parks related to Resort:
=> hidden link

And then I've created another view to fetch the events related to Parks namely "events-belong-to-parks":
=> hidden link

And I've added the "events-belong-to-parks" view to the view "display-events-on-resort-single" loop output.

I can see now it's displaying the correct related events. Could you please confirm.

#1174114

Thanks Minesh, I can see it as well. There is no other way than doing this in a nested view? Unless I setup a relationship directly between Resort and Events I assume?

#1174125

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Actually no, because you need to loop through the relationship levels that is why it needs the nested view. However, using nested view is good practice and I strongly suggest it to follow that.

Addition another relationship for Resort and Events is another possibility but I do not suggest it until and unless you strongly require it and you have a clear idea about using it.

#1174129

My issue is resolved now. Thank you!