I have custom post types for Books and Articles. I want to create a page that aggregates each of these CPTs by subtopic (see attached mockup) and displays 2 books and 1 article. A book or article may appear in more than one subtopic.
I've done something similar with Advanced Custom Fields before, where I created a CPT called Subtopics and selected the appropriate Books and Articles as children. Reading through Toolset's documentation, I don't think it can be done this way. Instead, I'm trying to create a View.
Questions:
Am I write that I can't do this with Toolset by creating a parent CPT for Subtopics? That would be my preferred method if it's doable.
Alternately, if using Views I'm guessing they'll need to be nested... Books and Articles within Subtopics within the Topic page.
I've been searching through Toolset's forums and documentation, but would appreciate any guidance on how to best do this.
The Correct Way to do this is to have the Topic as the Parent CPT and Subtopic the child and then book and article being Children of subtopic.
With a Relationship setup you should be able to achieve this using our Views plugin to display the correct relationship information by nesting the views.
Are you aware of how to set all this up correctly?
I set up my custom post types with the appropriate relationships and had no problem creating a view to display Books:
hidden link
I'm now trying to create a Parent View that displays the Title of each Subtopic following by the Books View displaying just the Books in that Subtopic, so I can loop through the Subtopics.
By way of example, here's a page where I'm displaying each Subtopic title:
hidden link
But the Books View pulls the same 3 books regardless what Subtopic I'm looping through (even though I've set up Relationships for each Book). I know I can filter the Books directly in my Books View, but that would mean creating a Books View for each Subtopic. How can I tell the Books View to pull the Books for the Subtopic. Here's my Loop Wizard code:
The example talks about the Post Author filter but instead of Post Author you will use the Post Parent filter then select "Parent is the current post in the loop"
This should start allowing your items to display based on the Subtopic. If this does not work please let me know.
I added a Post Parent Filter to the Books View, but now it says No Items Found:
hidden link
I double checked that each Book is in a child relationship to a Subtopic. I have a couple Subtopics with no Books assigned, but the Sample Content Subtopic and Intro to Civic Engagement both have Books assigned to them.
Screenshot of my Post Parent Filter settings for the Books CPT attached.