My site has a custom post type named Resource. The Resource custom post type has a custom taxonomy named Curatorial Categories. The Curatorial Categories taxonomy has two custom fields: a checkbox (to display this category on the homepage) and a field into which a number can be entered to control the sort order of the categories (on the homepage).
Programmatically speaking, what I'd like to do looks like this: for each Curatorial Category flagged to display on the homepage, get a list of Resource posts in that Curatorial Category and display them. The output should appear as follows:
Curatorial Category A Taxonomy Name
Post title of Resource 1 in Curatorial Category A
Post title of Resource 2 in Curatorial Category A
Post title of Resource 3 in Curatorial Category A
...
Curatorial Category B Taxonomy Name
Post title of Resource 1 in Curatorial Category B
Post title of Resource 2 in Curatorial Category B
Post title of Resource 3 in Curatorial Category B
...
Curatorial Category C Taxonomy Name
Post title of Resource 1 in Curatorial Category C
Post title of Resource 2 in Curatorial Category C
Post title of Resource 3 in Curatorial Category C
...
I think I need two Views: one to iterate over the taxonomy terms in the category, and one to iterate over the posts in that category.
Can you offer some guidance about how to accomplish this?
Thanks.
Saul
PS. I'm using the older legacy plugins to create Views and Layouts (not Blocks).
The outer View queries the taxonomy, and you'll add a Query Filter for the checkbox field (in the screenshot on my test site I have a Colours taxonomy and am filtering by a checkbox field "Is Primary"). Set the ordering by the custom field as required.
Then in the output section of this View you will insert a second View (you'll need to prepare it separately).
That View will query resource posts, and you add a taxonomy Query Filter where the term is "Set by the parent Taxonomy View", so that only resources with the "current" term from the parent View will be returned.
Hello. Thank you for contacting the Toolset support.
As Nigel shared and as you already assumed that, yes, you will require two views and you need to use the nested views (view inside view). One view that should iterate through the taxonomy terms and another view that should iterate through posts of Resource post type.
Thanks, Nigel and Minesh. I really appreciate the screenshot and link. For anyone else who stumbles on this thread, another link that helped was this one: