I have a CPTs called "Projects" and "People" in a M2M relationship so I can add people to a project.
On each Project single, I can show which People are on that Project.
On each People single page, I can show which Projects that person is on.
What I want to do is show on each People single page the other people they have worked with. In other words, a list of people attached to the Projects that this person is also attached to. So pull the people from the people-project relationship and display them on the people page.
I think I need to do this with nested views, but I can't get it to work. Best I can do is get a list of all the people, but it includes duplicates. If person A worked on project X and Y with Person B, Person A will be on Person B's page twice.
Hello. Thank you for contacting the Toolset support.
Can I have a single people (person) post link where you list all people but also that example on that single people (person) post link what are the other people (person) you expected to dispaly.
*** 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.
As you can see I've dded the view "get-related-people-ids-belongs-project" to get the related people ids belongs to project.
And with the view "people-from-projects-view" I've added the Post ID query filter to filter with shortcode attribute "relatedpeopleids":
Post ID filter
Include only posts with IDs set by the View shortcode attribute "relatedpeopleids" eg. [wpv-view name="view-name" relatedpeopleids="1"]
- hidden link
Then on your single people(person) content template:
- hidden link
As you can see we are passing the found related people IDs belongs to project using the view "people-from-projects-on-people-view" and pass the found people IDs to shortcode attribute "relatedpeopleids".