[Resolved] Showing data from a relationship in a view
This support ticket is created 2 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Tell us what you are trying to do?
I am currently working on a view. Obviously adding fields for the chosen post type is working well, but I would like to include data from a "related" post type. Is this possible in a view?
Is there any documentation that you are following?
I've not found documentation for this, but I may be looking in the wrong place.
Is there a similar example that we can see?
No sorry, I've not found one.
What is the link to your site?
My development site is at hidden link
Now, suppose that you have a one-to-many relationship ( relationship slug "author-book" ) between "Authors" and "Books" post types so that one author can have many books. To show the title from the related author post in the view for the books posts, you can use the item attribute with the same "[wpv-post-title]" shortcode, like this:
Hi Waqar thank you for this information, I will work through your suggestions. I've not tried to do something like this before, so this is very helpful.
I can see how the data could be displayed, the problem I have is I'm mixing data from the "Articles" post type and then wanting to add data from the "ACNR Authors" post type. So I'd like to display the title (and link) of the five latest articles in a view together with the authors that wrote the article (which will be in the ACNR Authors post type). So if I'm understanding this correctly, those two bits of data need their own views? Am I understanding that correctly?
Thanks for writing back and glad that my message helped.
If your goal is to show the "ACNR Authors" posts related to each of the five latest "Articles" posts, then yes you'll need to use two separate post views.
1. The parent view will be set to show the latest 5 "Articles" posts.
2. The child view will be nested in the loop of the first view, so that it shows the related "ACNR Authors" posts in relationship with the current "Article" post in the parent view's loop.