Tell us what you are trying to do?
I have a custom post type called Special Collections, which has a relationship connection to my custom post type of Departments. I am trying to create a view that shows all Special Collections with a relationship to any of 5 different departments. I know how to create a view that shows Special Collections related to a single department, but it does not appear that I am able to select more than one Department to display in my query filters.
I am following documentation here: https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/how-to-migrate-your-site-to-new-post-relationships/#advanced-example
but this example is code based and I am looking for a way to do this using the block editor.
Hello,
In your case, it needs nested post views, for example:
1) Parent department post view:
- Query department posts
- Filter by:
Include only posts with the following IDs: 123, 456, 789
- In view's loop, display below child post view
2) Child post view:
- Query "Special Collection" posts
- Filter by:
post type relationship between "Special Collections" and "Departments"
- In view's loop, display Special Collection information
When I attempt to do this, I get an error message that states 'nested views are not supported.'
You need to setup the child post view with legacy editor, see our document:
https://toolset.com/course-lesson/enabling-legacy-version-of-toolset-views/
See below sandbox website:
Login URL: hidden link
1) Child Special Collection view:
hidden link
- Query Special Collection posts
- filter by:
Select posts in a departments Special Collections relationship that are a related to the current post in the loop
2) Single department content template:
hidden link
Display a view block:
- Query department posts
- enable option "Don't include the current page in the query result"
- Sort by "Random order"
- ITEMS TO DISPLAY: 5
- In view's loop, display a view block, and choose above child post view "Child Special Collection view"
Test it in frontend:
hidden link
It works fine.
For your reference.