我用下面的代码获取分类毛坯:撷取分类弹头
<?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