问题描述
我建立了一个有两个部门"的网站,比方说'shoes' 和'caps'.网站顶部有两个链接,通过这些链接人们可以切换部门,根据他们所在的部门,样式和内容略有不同,有些部分相同,有些则不同.对于职位,这两个部门都是一个分类法,因此新职位可以属于其中一个部门,也可以属于两者.
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.
还有一个分类法'brands'.
我现在想要的是获取部门 'shoes' 中使用的所有 'brands' 的列表.
What I would like right now, is get a list of all 'brands' that are used in the department 'shoes'.
我知道您可以使用 wp_list_categories
或 get_terms
或 get_the_term_list
之类的函数来获取术语列表.但有可能做我想做的事吗?
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.
推荐答案
很有可能.如果您有常见品牌,您可能需要自定义查询.如果品牌之间没有重叠,我建议您将分类法分离为具有 shoes_brands 和 cap_brands,以便您可以使用内置函数/查询.
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.
这篇关于获取按多种分类法类型过滤的分类法链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!