Skip Navigation

[Resolved] Getting data from descendent relationships (parent/child)

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

Last updated by Richard 5 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#1285679

I really only need a yes/no answer at the moment as I'm working on some CPT/Custom field/Relationships and want to get my dataset right.

If we start with a parent CPT which is related to a Child CPT which in turn is related to a grandchild CPT can any of those levels access field data from both antecedents and descendants ?

Example. Country/Region/Sub-Region/Town

Case 1 - Can I display the Country on a Town post
Case 2 - Can I display a field from the Town CPT within the Country

I'm trying to avoid duplicating data in all the CPTs so for example I don't want to (or don't think I need to) display the region data in the town CPT. I'm hoping I can get it via the sub-region which is the parent of the town.

Like I said I don't need any help doing it just yet - just need to know it's possible so I can get my dataset sorted out.

#1285917

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Yes - its possible.

Example. Country/Region/Sub-Region/Town
Case 1 - Can I display the Country on a Town post
- To display the great grand parent value on child post you can use the following method:

More info:
=> https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-fields-of-grandparents/#3-create-a-content-template-that-displays-grandparent-information

Case 2 - Can I display a field from the Town CPT within the Country
- To display the last child you need to loop through the child post using the view:

More info:
=> https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-related-child-posts/

#1286633

My issue is resolved now. Thank you!