Skip Navigation

[Resolved] Display fields of grandparents without using a View

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

Problem:
Display fields of grandparents using content template on single post

Solution:
You need to use the [wpv-post-body] shortcode with item attribute.

You can find the proposed solution, in this case with the following reply:
https://toolset.com/forums/topic/display-fields-of-grandparents-without-using-a-view/#post-1213071

Relevant Documentation:
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

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
- 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 4 replies, has 2 voices.

Last updated by Ben 5 years, 11 months ago.

Assisted by: Minesh.

Author
Posts
#1212293

Ben

Is it possible to display fields of grandparents without using a View?

For example, inserting the shortcodes directing into a page template somewhere. Or does this method need the "context" of the View for it to work properly?

#1212408

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - I would like to know here where exactly you want to display the grandparent information? On a single page of the bottom child (the last child post) post in the relationship or you are displaying child posts using the view?

#1212617

Ben

Hello Minesh!

I would like to display this information directly on the last child post.

#1213071

Minesh
Supporter

Languages: English (English )

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

Hi Ben,

You can use the same method which is mentioned here:
=> 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

So, considering the following relationship:
- State
-- City
--- Employee

Create new content template and add the fields to it - the top level (state-city relationship slug):

[wpv-post-link item="@state-city.parent"]

Then when you add content template - add the item attribute to content template using the (city-employee relationsihp slug):

[wpv-post-body item="@city-employee.parent" view_template="ct-to-display-state-of-employee-post"]
#1213252

Ben

Thank you Minesh.

This has worked perfectly.