特别感谢我对最后两个问题的每一个回复,我还有另外两个重要的两个: 第一个:我需要下一个代码从一个我的自定义帖子类型的特定分类。我尝试用数组('fields'=>'proceeding')替换:array('fields'=>'all'),以仅从继续分类中获得meta术语,但它不起作用。有什么建议吗? 秒:当从所有分类法中获取所有术语时,是否有任何方法让代码根据不同的分类法显示不同行上的术语?wordpress:如何获得单个自定义帖子类型的特定meta条款
foreach ((array) get_object_taxonomies($post->post_type) as $taxonomy) {
$object_terms = wp_get_object_terms($post->ID, $taxonomy, array('fields' => 'all'));
if ($object_terms) {
echo ': (- ' . $taxonomy . ': ';// I modify the output a bit.
$res = '';
foreach ($object_terms as $term) {
$res .= '<a href="' . esc_attr(get_term_link($term, $taxonomy)) . '" title="' . sprintf(__("View all posts in %s"), $term->name) . '" ' . '>' . $term->name . '</a>, ';
}
echo rtrim($res,' ,').')';// I remove the last trailing comma and space and add a ')'
}
}
你是什么意思,它没有工作。请提供确切的不良行为。 – 2015-02-05 15:56:01
你好,当用array('fields'=>'proceeding')替换数组('fields'=>'all')时,没有任何内容出现,元语术语也没有分类法。 – nisr 2015-02-05 17:05:41