How can I display a custom post type post, within 2 custom taxonomies?

I have a Custom Post type called Artists.
I have 2 Custom Taxonomies:

Taxonomy 1: Edition / Terms 1: 2019,2020,2021,2022,2023
Taxonomy 2: Day / Terms: Wednesday, Thursday, Friday

How can I show all Artists that are in Edition 2022 AND Day Wednesday?

(I have this: <Loop type=artiesten sort_field=aanvang order=asc taxonomy=dag terms=woensdag> That works, but I can’t figure out how to select Both taxonomies)

Hi Frans, welcome to the forum!

You’re on the right track and there’s actually an example on the documentation page for the post loop (quoted below) that might point you in the right direction. Basically, you’ll need to use the taxonomy_2 and terms_2 parameters to filter posts based on your two taxonomies. By default, it’ll display posts that have any of those two terms applied so to only display artists that have both applied, you’ll also need to
use taxonomy_compare=and. Here’s the example from the docs:

The example below will display posts in an “agency” custom post type that have both the taxonomy terms “marketing” and “creative” applied to them in a custom taxonomy called “expertise”

<Loop type=agency taxonomy=expertise taxonomy_compare=and terms=marketing,creative>

I’m not sure if you’re already thinking about this or if it’s relevant to your use case, but if it makes sense given what you’re trying to do, you could probably use the Date tag to dynamically refer to the year, so if you wanted to dynamically refer to last year, instead of writing terms_2=2022 you could write terms_2="{Date format='Y' subtract='1 year'}" or something like that. Best of luck with L&L!

Hi Benjamin,

Thank you so much for pointing me in the right direction. It works, I have this:

<Loop type=artists sort_field=start order=asc taxonomy=day taxonomy_2=edition  taxonomy_compare=and terms=wednesday terms_2=edition2022>
	
1 Like