Think it was resolved by myself…
function my_get_category_parents($id, $separator = '/', $visited = array()){
$chain = '';
$parent = &get_category($id);
if ( is_wp_error( $parent ) )
return $parent;
$name = $parent->cat_name;
if ( $parent->parent && ($parent->parent != $parent->term_id) && !in_array($parent->parent, $visited) && ($parent->parent != 49) ) {
$visited[] = $parent->parent;
$chain .= my_get_category_parents($parent->parent, $separator, $visited);
}
$chain .= '<a href="' . get_category_link($parent->term_id) . '" title="' . sprintf(__("View all posts in %s"), $parent->cat_name) . '">'.$name.'</a>' . $separator;
return $chain;
}
call with:
<?php echo(my_get_category_parents($cat, ' » ')); ?>
Another question…
<?php echo(get_category_parents($cat, TRUE, ‘ » ‘)); ?>
will output:
Internet » Blogging » WordPress » Test Category »
How can I make it display the Parent Category Name only?
Blogging » WordPress » Test Category »
The “Blogging” category have id=32.
How to show categories from current (child child of 32) to category with id 32 and trim alll other parent categories?