Get taxonomy links filtered by multiple taxonomy t

2019-09-16 18:58发布

问题:

I've build a website that has two 'departments', let's say 'shoes' and 'caps'. There are two link at the top of the website, and with those links people can switch departments, and depending on which department they are on the styling and content is a bit different, some parts are the same, others are not. For posts both of these departments are a taxonomy, so a new post can belong to either one, or both.

There is also a taxonomy 'brands'.

What I would like right now, is get a list of all 'brands' that are used in the department 'shoes'.

I know you can use functions like wp_list_categories or get_terms or get_the_term_list to get list of a term. But is it possible to do what I want?

I hope my question is clear enough.

回答1:

It is very possible. If you have common brands you may need a custom query. If there is no overlap between brands I would suggest you segregate the taxonomies to have shoe_brands and cap_brands so you can use a built in function/query.