admin管理员组文章数量:1404458
I need to figure out how to get post category as a string and link, both separate from each other. So the return would be something like:
Uncategorized
however both should be separate, because I need to put them in different parts of my markup.
I need to figure out how to get post category as a string and link, both separate from each other. So the return would be something like:
Uncategorized
http://link-to-the-category
however both should be separate, because I need to put them in different parts of my markup.
Share Improve this question asked Apr 22, 2013 at 11:41 IljaIlja 1533 silver badges14 bronze badges 1- review codex.wordpress/Function_Reference/get_the_category – Michael Commented Apr 22, 2013 at 12:53
1 Answer
Reset to default 1First you have to find the category ID, which can be done easily with the function get_the_category()
.
To get the slug, use: $catID = get_the_category(); $catSlug = $catID->slug
.
To get the link: $catLink = get_category_link($catID)
.
本文标签: categoriesGet post category as a separate string and url
版权声明:本文标题:categories - Get post category as a separate string and url 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744817569a2626791.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论