Skip Navigation

[Resolved] Query and display posts with tags from different taxonomies

This support ticket is created 9 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by matthewD 9 years ago.

Assigned support staff: Luo Yang.

Author
Posts
#169210

I'm trying to create a View Query that lists only those "Classes" (a Custom Post Type) that are tagged with a "Level" taxonomy term AND a "Location" taxonomy term. Not that's it really relevant, but Classes is a child of Programs (i filter the Classes to only those in a Program via the "page where the View is inserted" filter setting).

For display, I want to "group" Classes by the two taxonomies, i.e. Location > Level > Classes (using Views within Views within Views?).

Example...

Chicago
Level 1
Class A
Class B

Chicago
Level 2
Class C
Class D

Tampa
Level 1 & 2
Class E
Class F

etc.

I know this might seem pedestrian enough of a View Query, but I'm hopelessly stuck. I am able to get the Classes grouped by Location (or Level) via a Classes View within a taxonomy View, but how do you continue to a second taxonomy term grouping?

Should I have created a hierarchical (category) taxonomy instead?

Is there simpler way to filter on multiple taxonomies at the same time?

Thanks in advance,
Matt D.

#169987

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hi Matt,

1) Should I have created a hierarchical (category) taxonomy instead?
In your case, please try create a hierarchical (category) taxonomy instead. since there isn't relationship between "Level" taxonomy AND a "Location" taxonomy
2) Is there simpler way to filter on multiple taxonomies at the same time?
in other cases, you can try filter by views shortcode attribute.
More help: Value set by View shortcode attribute
https://toolset.com/documentation/user-guides/filtering-views-by-taxonomy/

#170055

Hi Luoy,

Thanks for the quick reply back.

Re 1)... Since Categories cannot have shared sub-categories (well, it pseudo-can, via same-name-different-slugs), and since such an approach really isn't what it appears, since there would be no relationship between same-named sub-categories (since they're different slugs), making "Location" and/or "Level" a CPT seems to make sense, since I can make one a child of the other, and/or make each a parent of a Class. Way more flexible.

Re 2)... "value set by View shortcode" attribute is essentially hard-coding, so using the approach would mean creating specific coded Views for each taxonomy pairing.

It would be nice to have a "Group by..." feature in Views that allows for unlimited grouping by found field, like Drupal's Views 3. I was able to recreate in 5 minutes in Drupal what I'm struggling to create here.

Thanks again for the assistance, and keep up the great work on Toolset. It's getting better and better every version.

Matt D.