With wp_get_object_terms() you’re able to manipulate the sorting.
Make sure you tweak the sorting to what you want.
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);
Output a list of all public custom taxonomies
<?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>';
}
}
?>
Output a list of all public custom post types
<?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>';
}
?>