Skip Navigation

[Resolved] How to show fields from related posts

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

Problem:
A View lists posts of one type which are in a relationship with another post type. How to list fields from the related posts?

Solution:
Use the Fields and Views button to insert the field and use the Post Selection tab to specify that the source for the field should be the related post rather than the default current post, and that will insert the shortcode with the required attributes (namely the item="$relationship-slug.parent|child" arribute).

This support ticket is created 6 years, 1 month 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 2 replies, has 2 voices.

Last updated by David Gimenez 6 years, 1 month ago.

Assisted by: Nigel.

Author
Posts
#1131097

Hi.

I'm following the instructions of: https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/

I've seen that examples shows related posts of a single post.

I have 2 custom post types

Families
Sons -> Here i have a repetable field too (activities)

Relationship is one (Family) to many (Sons)

I need to show a list of Sons with some custom fields + one custom field of Families

I don't know the way to get this

I have view of sons that lists all results, getting one custom field of families. This custom field is empty in the list that I'm showing

I have a view of Sons + Family -> If I select the 2 custom post types it shows all but without related posts. Every custom post type is in own column

Any suggestion? Is it possible to get all

I'd like to get

Name of Son XXXXXXX - Name of family 1 - Taxonomy of Son
Name of Son XXXXXX2 - Name of family 1 - Taxonomy of Son
Name of Son XXXXXXX - Name of family 2 - Taxonomy of Son

Thank U

#1131867

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi David

If you want to list Sons then your View should just query Sons (in the Content Selection).

In the output section, it should be straightforward to output fields of the Sons (including taxonomies).

To output fields of related posts, namely the connected Family, then you should be able to use the Fields and Views button to insert the field in question, and use the Post Selection tab to switch which post is used as source for the field, where you should find related Family posts as an option.

When the shortcode for the field is added, it should include an item attribute that points to the related post.

#1132003

My issue is resolved now. Thank you!