Problem: I have 3 post types in a child -> parent -> grandparent hierarchy relationship. I would like to display information about the parent and grandparent in the child post.
Solution:
Access information about a parent post, you can use the following syntax:
[wpv-post-title id="$parent-type-slug"]
So for example, if your city post type slug is "city", then your code will be:
[wpv-post-title id="$city"]
To access information about a grandparent post, you can use a Content Template to change the context by passing in the $city operator for the id attribute:
[wpv-post-body id="$city" view_template="your-content-template-slug"]
Inside that Content Template, you can then use the parent post technique we used before to access the grandparent country post. If your country post type slug is "country" then your code in the Content Template will be:
[wpv-post-title id="$country"]
Relevant Documentation:
https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/
https://toolset.com/documentation/user-guides/displaying-fields-grandparents/
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 |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 2 replies, has 2 voices.
Last updated by 6 years, 11 months ago.
Assisted by: Christian Cox.