我正在为WordPress主题目录创建一个WordPress包主题。我为我的自定义帖子类型portfolio创建了一个分类法(名称:speciality)。我可以拿到列表:
echo get_the_term_list( $post->ID, 'speciality', 'Portfolio Specialities: ', ', ' );但我需要一份这个“专业”分类的弹丸列表。甚至我也想要单一的弹状物名称‘专业’的分类。
如何获取此自定义分类的slug/slug-name列表?
发布于 2014-11-11 17:14:18
下面的代码应该会有所帮助
$terms = get_the_terms( $post->ID, 'speciality' );
foreach( $terms as $term ) {
echo $term->name . " : " . $term->slug;
}有关更多信息,请查看Codex
https://stackoverflow.com/questions/26854431
复制相似问题