If both terms (the one you want to filter by, and the one you want to group by) are part of the same taxonomy (category), then I don’t think there is an easy way to do this through the UI alone.
The problem is that there is no existing (core) way to get just 1 specific category for a post during a loop. You can get all the terms using something like the_category()
, but you can’t get just one, nor exclude any.
If the data you wanted to group by was part of a different taxonomy, or if one of these things was metadata, it would be a bit easier.
Both would be from the WP core Category taxonomy. But different “vocabularies”.
So, one is from (parent) Stakeholder — used to filter.
The other term that I’d like to group the results by is Topic (parent).
It would be fine for WP to retrieve all categories in the query — that would be great. But, true, I would want to include only specific one(s), thereby excluding others.
Guess I am accustomed to this feature in Drupal Views. Your WP plugin is a godsend, and my fave. So, thanks for taking it as far as you can, and continuing to expand it.
Maybe there is a WP taxonomy plugin to isolate better — vocabulary and terms? I haven’t really explored that.
Hi tyme,
My favorite way to use WP is like Drupal, so one of the first things I get is a Content Type creator plugin and a fields plugin.
Using Advanced Custom Fields, you could create a taxonomy field on your posts that only allow for 1 term. Still in ACF, you can configure that field’s output. Then in Query Wrangler you can add that field to a query using the “Meta value” QW field type. With ACF installed, you’ll see an option to choose ACF as the display handler for that field, and this should give you the results you’re looking for. From there, all you have to do is Group by that field in the Row Style settings.
Hope this helps,
Jonathan