有没有一种方法来显示分类术语而不是链接?WordPress的 - 显示分类术语没有链接 - (get_terms,the_terms,wp_tag_cloud)
我基本上想要显示我的“标题”的分类标准下的所有术语,但没有它们是链接。
我试过多个解决方案,比如get_terms,get_the_terms,the_terms,wp_tag_cloud,但是我找不到解决方案。
谢谢。
有没有一种方法来显示分类术语而不是链接?WordPress的 - 显示分类术语没有链接 - (get_terms,the_terms,wp_tag_cloud)
我基本上想要显示我的“标题”的分类标准下的所有术语,但没有它们是链接。
我试过多个解决方案,比如get_terms,get_the_terms,the_terms,wp_tag_cloud,但是我找不到解决方案。
谢谢。
$terms = get_terms("taxonomy");
$count = count($terms);
if($count > 0)
{
echo '<ul>';
foreach ($terms as $term)
{
echo '<li>'.$term->name.'</li>';
}
echo '</ul>';
}
下面的代码检索分类中的所有条款名称:
$terms = get_terms('cars', array('fields' => 'names'));
的离奇该解决方案返回的所有条款,如果您需要显示只有每个你可以使用这个帖子项条款:
$terms = wp_get_post_terms($post->ID, 'taxonomy-term', array("fields" => "names"));
echo implode(', ',$terms);
确保获得正确的“分类术语”正确!