具有wp_get_object_terms() 您可以操纵排序。
确保根据需要调整排序。
Try something more or less like this (Updated: 5/17/2012 -- 8:15AM):
$taxonomyName = \'producttype\';
$terms = wp_get_object_terms($wp_query->post->ID, $taxonomyName, array(\'orderby\' => \'name\', \'order\' => \'ASC\', \'fields\' => \'all\'));
if(!empty($terms)){
if(!is_wp_error($terms)){
for($i = 0; $i < count($terms); $i++){
if($terms[$i]->parent != 0){
$termChildren[] = $terms[$i];
}
}
}
}
print_r($termChildren);
输出所有公共自定义分类的列表
<?php
$args=array(
\'public\' => true,
\'_builtin\' => false
);
$output = \'names\'; // or objects
$operator = \'and\'; // \'and\' or \'or\'
$taxonomies=get_taxonomies($args,$output,$operator);
if ($taxonomies) {
foreach ($taxonomies as $taxonomy ) {
echo \'<p>\'. $taxonomy. \'</p>\';
}
}
?>
输出所有公共自定义帖子类型的列表
<?php
$args=array(
\'public\' => true,
\'_builtin\' => false
);
$output = \'names\'; // names or objects, note names is the default
$operator = \'and\'; // \'and\' or \'or\'
$post_types=get_post_types($args,$output,$operator);
foreach ($post_types as $post_type ) {
echo \'<p>\'. $post_type. \'</p>\';
}
?>