I have POSTS (podcasts)
And I have SPEAKER which is a custom post type, with a many-to-many relationship with POSTS.
I have a working view that shows all my POSTS, and which can be filtered by related SPEAKER. Works great.
But how do I display a list of the related speakers as I loop through each POST? I've been playing with the "Fields and Views" button for half an hour and I can't figure it out. See attached. I'm hoping there's a shortcode for listing out the related speakers (instead of having to nest a second VIEW within this view...)
Thank you for contacting us and I'd be happy to assist.
Your understanding is correct and whenever you need to show multiple related posts, a view with a relationship filter will be needed.
In this case, you'll create a new post view to show the "SPEAKERS" posts and in the "Query Filter" section, you'll include a relationship filter to show only the results related to the current "POST" in the parent view's loop.
Once the view is ready, you can place its shortcode, in the parent view's loop, where you'd like to show the related speakers.
I hope this helps and please let me know if you need any further assistance around this.
Interesting, thank you! So I understand that I will need to "nest" one view inside of the other view.
Will this have a significant performance impact? The reason I ask is because the view that shows my podcasts uses an infinite scrolling method to load new results, and it's already a little slow for each refresh.
Nesting of view will have some performance impact, because, the child view's query will be running for each result item in the parent view.
To improve the performance, you can keep the result per page number in the parent view to a lower value (for example between 5-10), and in the infinite scroll settings, set only 1 page for pre-loading.
( example screenshot: hidden link )