admin管理员组文章数量:1277875
For my wp theme I want to use the categories as tags on my posts. Example:
The problem is that the category in red must always be the parent and in gold the child.
Except that returns the categories to me in alphabetical order and not in hierarchical order, so sometimes I end up with the child in red and the parent in gold ...
Knowing that I would only use 2 categories per posts so 1 = the parent and 2 = the child
Do you have a solution?
For my wp theme I want to use the categories as tags on my posts. Example:
The problem is that the category in red must always be the parent and in gold the child.
Except that returns the categories to me in alphabetical order and not in hierarchical order, so sometimes I end up with the child in red and the parent in gold ...
Knowing that I would only use 2 categories per posts so 1 = the parent and 2 = the child
Do you have a solution?
Share Improve this question asked Nov 8, 2021 at 17:55 MaximusMaximus 31 bronze badge1 Answer
Reset to default 2You could assign the post only to the child category, and call the function like so:
the_category( ' ', 'multiple' );
This will output (notice the whitepsace between the anchor tags):
<a href="https://example/category/parent/">parent</a> <a href="https://example/category/parent/child/" rel="category tag">child</a>
本文标签: phpEdit thecategory () for a hierarchical display
版权声明:本文标题:php - Edit the_category (); for a hierarchical display 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741230299a2361996.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论