On this site hidden link we have the post type 'publications' which is connected by relationships to both 'contributors' (authors of the publication) and 'content partners' (the organisation responsible for the publication).
On this page hidden link views display the number of publications and features produced by this content partner.
I would also like to display the total number of contributors working for this content partner, but the posts are not directly connected - both are connected only to the publication. Is there a way to do this with Views?
And then related to this, I'd like to display the taxonomies of the publications connected to the this content partner - see here hidden link - this is in the old version of this site that we are migrating from Wagtail to WordPress and I need to achieve the same thing. Is this possible with Views? I need to display all the relevant subjects, and also a total count, but not show duplicates - i.e. consolidate the results across all the publications.
Hi,
Thank you for contacting us and I'd be happy to assist.
You can use the nested views to show the count of related posts and the taxonomies. And since the nesting of views is only supported in the classic/legacy views, you'll be using the classic/legacy editor views for this and not the blocks-based views.
For example, on the partners page, you'll use a parent view, to first show the related publications posts.
( ref: https://toolset.com/documentation/legacy-features/views-plugin/displaying-related-child-posts/ )
And inside the loop of this parent view, you'll include another view that will show the contributors, related to the current publication loop item.
Alternatively, if you're comfortable with PHP code customizations, you can also use the Toolset Relationship API, to programmatically get the related posts:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
Note: For more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/
I hope this helps and please let me know if you have any follow-up questions.
regards,
Waqar
Thanks Waqar - I can get nested views to show a list of contributors fairly easily, but the issue is that some of the contributors are duplicated - i.e. the same contributor may have written many publications, and I don't want them duplicated. And then I don't actually want to show the names of the contributors, just a cumulative total (excluding duplications of the same name (linked contributor post).
Thanks for writing back.
If you decide to use the nested views for this, you'll need some custom script to remove the duplicates and then count the cumulative total of the remaining items.
For someone proficient with PHP, it would be straightforward and neater to get this count using the 'toolset_get_related_posts' function.