I have a post type called Students and a post type called Routes, with a many-to-many relationship between them.
I have created a view that lists the students and the routes that they have been assigned to. I can visually identify those without a route assignment, but it would be useful to be able to filter these records to ONLY show those posts where no relationship between the post types exists.
Hello,
I assume you are going to get all "Students" posts without related Routes post setting.
As you see, there isn't such kind of built-in feature within Views plugin, but there is a workaround:
1) Since you can get those "Students" post IDs with related Routes post setting, you can pass them to below post view as shortcode attribute "ids"
2) Setup a post view:
- Query Students posts
- Filter by:
Exclude posts with IDs set by the View shortcode attribute "ids"
See screenshot: exclude.JPG
More help:
https://toolset.com/documentation/user-guides/filtering-views-query-by-post-id/
Hi Luo
I'm sorry but that doesn't make any sense to me.
To show the students assigned to routes I have a 'child' view that pulls the route assignment and then I show that view within the loop of the parent view.
I'm assuming that I would duplicate these views and then modify one of them along the lines of what you have suggested?
Yes, you can duplicate these views and then modify the outputs: output only the post IDs in comma separator format, for example: 123, 456, 789
Then pass the result as View shortcode attribute "ids" as I mentioned above.
See similar thread here:
https://toolset.com/forums/topic/the-paginations-are-not-appearing/#post-1319885