Skip Navigation

[Resolved] A view displaying fields from one CPT, in a content template for another CPT.

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

Problem: I would like to display fields from one custom post type in another custom post type by relating posts to one another.

Solution: You can use a post reference field to establish a link between two posts in different post types. Then you can use a Fields and Text block to insert fields from a related post in the Content Template.

Relevant Documentation: https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/using-post-reference-fields-to-display-information-from-a-related-post/

This support ticket is created 4 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
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 andrewS-10 4 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#1707985

I have two CPT's.

The first CPT is called "Team members". The second CPT is called "Articles".

I would like to use a view displaying field values from "Team members", within the content template for "Articles".

In other words; associate one "Team member" with one "Article".

So I can display (for example) a "Team member" title within the content template for an "Article".

Is this possible?

#1708047

Hello, yes it is certainly possible to display fields from one post in another post. A View is designed to display more than one post, so it would be more useful with a one-to-many or a many-to-many relationship. However, you only need to associate one post to one other post, so a View isn't really necessary. You can display fields from one post in another related post easily without the need for a View when you use a Post Reference field to connect the posts. We have more information about using Post Reference fields available here: https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/using-post-reference-fields-to-display-information-from-a-related-post/

Let me know if you have questions about that or if you have trouble implementing it, and I can offer more guidance.

#1708169

Thanks! I followed the instructions in the documentation you pointed to, and success!

Just one more "nice-to-have", but not essential:
From each post in one CPT, I intend to connect to 4 or 5 fields in the other CPT post. Is there a way to group those fields, so only one connection field needs to be selected? (Kinda like a view containing the 4 or 5 fields.)

#1708859
Screen Shot 2020-07-16 at 10.19.03 AM.png

Is there a way to group those fields, so only one connection field needs to be selected?
What about another Content Template, like a nested Content Template? You can display as many or as few fields from post A in post B as you'd like. I'm not sure I understand what you mean, can you provide more details?

Let's say you have post type A connected to post type B with a post reference field. You want to display several fields from post type A in the Content Template for post type B. So in that template for post type B, insert a Fields and Text block. Each time you insert a field in that block, you'll have the option to choose from which post you want the field to be displayed (screenshot attached).

#1709039

My issue is resolved now. Thank you!