如何从定制文章类型的帖子中显示分类/术语? 时间:2017-07-13 作者:Caesar [已解决]通过分类筛选,它将给出自定义post类型的postype结果。我将结果编程为一种后网格。我看到的问题是,我无法从其他分类法中获取筛选后产生的post类型的术语。到目前为止,我一直在尝试的内容需要一个post ID,或$taxonomy,。。。这取决于归档文件{post type}中的结果。php或分类法。php。我应该寻找哪种函数? 1 个回复 SO网友:Caesar 就是这样,啊哈,我喜欢,啊哈。。。<?php // Get terms for post $terms = get_the_terms( $post->ID , \'oil\' ); // Loop over each item since it\'s an array if ( $terms != null ){ foreach( $terms as $term ) { // Print the name method from $term which is an OBJECT print $term->slug ; // Get rid of the other data stored in the object, since it\'s not needed unset($term); } } ?> 结束 文章导航