我用下面的代碼獲取分類毛坯:擷取分類彈頭
<?php
$terms = get_the_terms($post->ID, 'locations');
if (!empty($terms)){
$term = array_shift($terms);
}
?>
然後我用下面的代碼輸出毛坯:
<?php echo $term->slug; ?>
我的問題是,我怎麼能使用它在相同的位置輸出兩種不同的分類法?例如:
<?php
$terms = get_the_terms($post->ID, 'locations', 'status');
if (!empty($terms)){
$term = array_shift($terms);
}
?>
我想我可以添加術語'位置','狀態',但它不起作用。
感謝評論。我已經更新了我的答案,使其更清晰。我正嘗試使用上面的代碼輸出兩個不同的分類法。 – CharlyAnderson
它真的取決於你想輸出什麼? –
我想輸出分類學slu。。 – CharlyAnderson