我有一个自定义的post类型(dibujos)和4个自定义的分类法。
我想在当前的帖子中获取术语名称。
问题是,无论分类法是什么,如何显示分类法的名称。
代码为:
<?php // Get terms for post
$terms = get_the_terms( $post->ID , \'my-taxonomy\' );
// Loop over each item since it\'s an array
if ( $terms != null ){
foreach( $terms as $term ) {
// Print the name method from $term which is an OBJECT
print $term->name ;
// Get rid of the other data stored in the object, since it\'s not needed
unset($term);
} } ?>
Thks!