Skip Navigation

[Resolved] Displaying Fields of Great-Grandparents

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

Problem: I would like to display fields of great grandparents but I can't figure out how to nest Content Templates.

Solution: Place one Content Template shortcode inside the contents of another Content Template to nest templates.

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

Last updated by perryL 5 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#1273753

Tell us what you are trying to do?
I want help displaying fields of great-grandparents. I cant figure out how to nest content templates in order to make it work. My post relationship structure is: chapter > section > subsection > content-block
I want to display a link to the chapter great-grandparent of the content-blocks

Is there any documentation that you are following?
This page mentions that content templates can be nested "This means that by nesting Content Templates which display parent contents, you can go as deep as you need." https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-fields-of-grandparents/

Is there a similar example that we can see?
hidden link

What is the link to your site?
hidden link

#1273761

Okay if you're in the Content-block post, you can use a Content Template to change the context to the parent Subsection.

Content Template 1: subsection-contentblock.parent

Then nested inside Content Template 1, you can place Content Template 2.

Content Template 2: section-subsection.parent

Inside Content Template 2, you can place Content Template 3.

Content Template 3: chapter-section.parent

Inside Content Template 3, you can display information about the Chapter post.

Your relationship slugs will probably be different, but nesting them together will allow you to display information from multiple levels of hierarchy.

#1273769

Could you clarify where and how I can nest one content template inside another? I have not figured that out. I think I might need an example with custom post types a > b > c > d for example. I am not clear if 'nesting' refers to the short code on the actual page or inserting code into the content templates. THANKS!

#1273781

Nesting Content Templates means you create multiple Content Templates, one for each level of hierarchy. Then you place one Content Template inside another using the Content Template shortcode wpv-post-body. For example:
In the Content Blocks Content Template code editor, you will place the subsection Content Template. Here is an example of the shortcode:

[wpv-post-body item="@subsection-contentblock.parent" view_template="subsection-template"]

In the Subsection Content Template code editor, you will place the Section Content Template.

[wpv-post-body item="@section-subsection.parent" view_template="section-template"]

In the Section Content Template, you will place the Chapter Content Template.

[wpv-post-body item="@chapter-section.parent" view_template="chapter-template"]

In the Chapter Content Template, you will display whatever information from the Chapter you want to display, like the post title or custom fields.

#1273801

My issue is resolved now. Thank you!