Skip Navigation

[Resolved] Needing to show post title/links from grandparent and beyond.

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

Problem:

I am using below post type relationship structures:

- Child post type "State"

-- parent post type "State Groups", relationship "States in Group"

--- Grandparent post type "Cluster", there are two relationships between post type "Cluster" and "State Groups":

"Cluster Shift From" and "Cluster Shift to"

---- Great-grandparent post type "Explorers", relationship "Explorer Clusters"

I need to show in great depth of context. "Before" States turn into "after" States, are nested into "before" and "after" State Groups which are connected in Clusters which are sometimes grouped into Super-Clusters and are ultimately owned by Explorers.

Solution:

You can follow our document to display parent-> Grandparent-> Great-grandparent posts information.

Relevant Documentation:

https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-fields-of-grandparents/

This support ticket is created 6 years, 3 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

Author
Posts
#1113935
B-Cluster Title Link (for State Group).jpg
A-Explorer Title Link (for Cluster post).jpg
Data Structure v2.png

I've got a somewhat complex Custom Post Types and Relationships structure to capture information I need to show in great depth of context. "Before" States turn into "after" States, are nested into "before" and "after" State Groups which are connected in Clusters which are sometimes grouped into Super-Clusters and are ultimately owned by Explorers. I'm attaching a graphic to show the different types and relationships.

I'm struggling with displaying this information beyond immediate parents and children. For example, I will need to display the linked Explorer post title on the State single page, which in some cases is the great-great-grandparent.

So far I have been attempting to follow the documentation here: https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-fields-of-grandparents/, with added info in this support ticket: https://toolset.com/forums/topic/displaying-grandparent-post-link-on-grandchild-post/ and many other places, trying to get a sense of how to create this complex nested template/view configuration.

At this point I am starting with basics, attempting to do a simple display of the Explorer name at the grandchild level, the State Group single post. Let me track the process here in detail.

First, I've created an unassigned content template (A) with only the post title link for the parent Explorer post, from the point of view of the child Cluster post. (Attaching image A.) When I insert this same shortcode into an empty Cluster post content field, it successfully displays the name of the parent Explorer. (hidden link)

Next, I've created another unassigned content template (B) with the post title link for its parent Cluster post, from the point of view of the State Group post. (Attaching image B.) In addition I've added the content template A and inserted the "item=..." designation as suggested in the documentation.

Inserting the shortcodes from this template B directly into a State Group post content field, I get successful display of the parent Cluster title link, but nothing at all for the grandparent Explorer. (hidden link). Applying the template B to the post type State Group yields the same result.

Can you help me figure this one out?

#1113948

I've requested a Hangouts call and would like to add context and flexibility. For context, I would like to look further into the full use case in which I will need to display information from great-great-grandparents, and via other complex relationships, through Views and Content Templates, (possibly also using Elementor for page building). As for flexibility, I am available to take this call at any time from early morning to late evening on Monday, US Pacific time. Thank you so much!

#1114776

Just checking in... haven't heard anything. Is there something more I need to provide? Looking forward to getting assistance in one way or another. I'm still stuck on this. Thanks!!

#1114893

Hello,

I got this ticket just now, but it is Tuesday now.

Yes, you are right, you are referring the right document:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-fields-of-grandparents/
Displaying Fields of Grandparents

It should be very simple to display the grand-parent post information, I don't think it needs video call, if you still need assistance for, please provide a test site with the same problem, also point out the problem page URL, and the relationships you want to display. I can setup a demo in your website.

#1115522

Your website is complicated, and the information are not enough:

We can handle the questions one by one:

Q1) display on the State Single post template is the Cluster (grandparent) and Explorer (great-grandparent) post titles with links
Which one is the parent post type?
I assume "State Groups" is the parent post type, and you are using below post type relationship structures:
- Child post type "State"
-- parent post type "State Groups", relationship "States in Group"
--- Grandparent post type "Cluster", there are two relationships between post type "Cluster" and "State Groups":
"Cluster Shift From" and "Cluster Shift to"
Which one do you want to use as the relationship of parent and grandparent? I use both of them as the demo
---- Great-grandparent post type "Explorers", relationship "Explorer Clusters"

Here are detail steps:
1) Create a content template for displaying "Great-grandparent Explorers post information":
hidden link
with codes:

Great-grandparent Explorers link: [wpv-post-link]

2) content template for displaying "grandparent Cluster post information":
hidden link
with codes:

Cluster post link: [wpv-post-link]
[wpv-post-body view_template="great-grandparent-explorers-post-information" item="@explorer-cluster.parent"]

As you can see, the second shortcode display content template of step 1, and using the relationship between the Great-grandparent and grandparent

3) Same as above, Content template for displaying "Parent State Groups information":
hidden link

State Groups link: [wpv-post-link]
cluster-shift-from: [wpv-post-body view_template="grandparent-cluster-post-information" item="@cluster-shift-from.parent"]
cluster-shift-to: [wpv-post-body view_template="grandparent-cluster-post-information" item="@cluster-shift-to.parent"]

4) Create a content template for single state post:
hidden link
with below codes:

[wpv-post-body view_template="parent-state-groups-information" item="@state-in-group.parent"]

Edit a state post:
hidden link
in section "content template", choose content template of step 4,

Test it in front-end:
hidden link

Please check if it is what you want.

For the question 2) Cluster Single post template is the list of States in each State Group linked to the Cluster by the Cluster Shift From and Cluster Shift To relationships.
It should be the similar steps, you can try to setup it manually.

#1116082
Explorer Page with View.jpg
View Query Section.jpg
View Loop Section.jpg
Data Structure v2.png

Hah, yes, you're right. It's complicated. I wish I could simplify but that's the structure of the information, and while I could probably flatten it a bit that would open up room for more of a mess, actually. Thank you for bearing with me and thank you very much for the example you provided. I can say now that I am starting to "get it" with these nested content templates.

Where I'm still having a little trouble is going in the opposite, child direction of the relationships, to where I need to loop a template into a View in order to display a list. I've set up the following. If you could take a look to help me see what's gone wrong, I would appreciate it.

I am attempting to display all the States connected to an Explorer. (I've uploaded the custom post types / relationships diagram again for your reference.) To do so, I've set up the following content templates. (POV is Point of View, a naming convention that helps me make sense of all this.)

***
POV Self: Post Title Link (pov-self-post-title-link)

[wpv-post-link]

POV State Group: State Title Link (pov-state-group-state-title-link)

[wpv-post-body view_template="pov-self-post-title-link" item="@state-in-group.child"]

POV Cluster (From): State Title Link (pov-cluster-from-state-title-link)

[wpv-post-body view_template="pov-state-group-state-title-link" item="@cluster-shift-from.child"]

POV Explorer: State Title Link (pov-explorer-state-title-link)

[wpv-post-body view_template="pov-cluster-from-state-title-link" item="@explorer-cluster.child"]

***

Then, I set up a View, POV Explorer: State Title Links. I've attached screenshots of my settings.

Finally, to test, I inserted the View directly into an Explorer page, to display as an unordered list. What displays is a series of blank list items, showing the correct number of bullets (18) as the number of States for the Explorer. But no titles/links display at all.

To test, I included another View I created, POV Explorer: Cluster Title Link as well as inserting the Content Template POV Explorer: State Title Link directly. The Cluster Title View worked as expected. The Content Template displayed a single State link, which I suppose is expected.

I've attached a screenshot of the page, which you can see directly here: hidden link

I imagine the unordered list is full of empty lines because of something missing in the View setup. Could you help me identify what went wrong?

Thank you once again for your patience and thoroughness in getting me to this point. I appreciate it. Hopefully very soon I'll be off and running.

#1116161

I assume the original question of this thread is resolved:
https://toolset.com/forums/topic/needing-to-show-post-title-links-from-grandparent-and-beyond/#post-1113935

For the new question Where I'm still having a little trouble is going in the opposite
Can we start a new thread for it? This can help other users, and I can split it into a new ticket for you. thanks

#1116591

Thank you Luo.

I've gone ahead and submitted the Views / child list question here: https://toolset.com/forums/topic/having-trouble-with-great-grandchild-view-lists/