我返回了来自三种不同分类法的术语列表。
$terms = get_terms(array("air-categories","web-categories","ink-categories"));
我得到了这个列表,我需要根据它们所处的分类法将它们链接到我网站的不同部分,但我似乎想不出一种方法来返回if语句,每个术语所处的分类法。
global $post;
$published_posts = wp_count_posts()->publish;
$terms = get_terms(array("air-categories","web-categories","ink-categories"));
$count = count($terms);
if ( $count > 0 ){
echo "<ul>";
foreach ( $terms as $term ) {
$c = $term->count;
$term_percent = log($c)*5;
echo "<li><a href=\'";
if( ***would like to check for the taxonomy here*** ) {
echo "***and then change the link here based on the result***";
}
echo "\'><span class=\'label\'>" . $term->name . "</span><span class=\'bar\' style=\'width:".$term_percent."%;\'></span><span class=\'count\'>". $term->count ."</span></a></li>";
}
echo "</ul>";
}
wp_reset_query();