Skip Navigation

[Resolved] Unable to get grandparent post field to display

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

Last updated by dbarber 5 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#1294251

I have the following 3 custom post types:

Events
Sessions
Speakers

In terms of relationships, Events can have Sessions and/or Speakers. And Sessions can have Speakers.

I want to be able to display links to events that speakers have spoken at on each speaker's profile page, but so far I am only able to display events where the speaker was added directly to the event.

I am not able to get links to events where the speaker was added to a session and then the session was added to an event.

I have tried every possible combination of post field relationship I know of - e.g.,

[wpv-post-link item="@event-speaker.parent"]
[wpv-post-link item="@event-speaker.child"]
[wpv-post-link item="@event-speaker.intermediary"]
[wpv-post-link item="@event-speaker.association"]

I've played around with query filters and content selections.

I have tried to get it to work with the instructions in this tutorial (on displaying grandfather fields): https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-fields-of-grandparents/

But, no matter what, I can't seem to get events to show up on a speaker's page if the speaker was added to a session (and then the session was added to the event).

I feel like I must be missing something obvious and have been staring at this for so long now that I am blind to it.

Please help me unbreak my brain.

#1294485

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

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 (Where you should replace the "state-city"relationship slug) with your Event-Session post relationship slug:

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

Then when you add content template - add the item attribute to content template using the (where you replace the "city-employee" relationsihp slug with Session-Speaker relationship slug.):

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

Does this help?

#1295203

Hi Minesh

Thanks for the quick reply.

I gave it a try on a Discover WP installation and failed a bunch more times before looking more closely at the item attributes in your example above (as well as in the post you linked to).

I realized one of the ones I was trying to use was incorrect, so I added the correct one and, after playing around with the filters for a bit, it's now working as it should.

Thank you so much for your help!

#1295337