Skip Navigation

[Resolved] Get post title from parent-parent/double relationship

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

Problem:
Get post title from parent-parent/double relationship

Solution:
To display the fields of the grandparent, Please check the following Doc:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-related-child-posts/

You can find the proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/get-post-title-from-parent-parent-double-relationship/#post-1224450

Relevant Documentation:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-related-child-posts/

This support ticket is created 5 years, 9 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 roulartaM 5 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#1224358
database-structure.jpg

Hi there!

I have a couple of tables (see screenshot) but my questions refers to three of them:

- shops (winkels)
- cities (gemeentes)
- provinces (provincies)

I've already made the 2 relationships so I can select all related data in the admin pages:

Gemeentes [0 .. 1] << Winkels [*] (=> 'gemeente-winkel-link')
Provincies [0 .. 1] << Gemeentes [*] (=> 'gemeente-provincie-link')

My question: how can I show the related province post title in my 'shops' view/loop on the front-end side? So in fact, I'm looking for a variable that first checks the cities relationschip ('gemeente-winkel-link') and then checks the provinces relationship ('gemeente-provincie-link').

Is there an answer for this? I Already tried those variables:

[wpv-post-title item="@gemeente-provincie-link.parent"]
[wpv-post-title item="@gemeente-winkel-link.parent@gemeente-provincie-link.parent"]
[wpv-post-title item="@gemeente-winkel-link@gemeente-provincie-link.parent"]
[wpv-post-title item="@gemeente-winkel-link.gemeente-provincie-link.parent"]

Thanks for helping!

#1224402

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - as I understand your structure, you have one to many relationship created using Types plugin between:
- Gemeentes (one) to Winkels (Many)
- Provincies (one) to Gemeentes (Many)

Now, is "shop" is your post type? If yes, both relationship is set as child of one to another post type.

Here is the doc that will help you to display the related child posts - you need a view for that and you need to filter your view by post relationship filter:
=> https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-related-child-posts/

If still not clear to you, you can share problem URL and access details with all required information what information you want to display exactly where and I will be happy to assist you further.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1224450

Minesh
Supporter

Languages: English (English )

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

Can you please check now:
=> hidden link

I've created the following content template:
=> hidden link

And added the shortcode to your view's loop as given under:

strong>Provincie:</strong> 
            [wpv-post-link item="@gemeente-winkel-link.parent"]  --- [wpv-post-body item="@gemeente-winkel-link.parent" view_template="display-provincie-for-winkels"]

This displays the parent Gemeente and further it displays the Provincie. You can adjust the code as per your requirement.

#1224453

My issue is resolved now. Thank you!