Get taxonomy links filtered by multiple taxonomy types

时光毁灭记忆、已成空白 提交于 2019-12-25 07:55:35

问题


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.



来源:https://stackoverflow.com/questions/10574899/get-taxonomy-links-filtered-by-multiple-taxonomy-types

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!