function get_level($category, $level = 0) {
if ($category - > category_parent == 0) {
return $level;
} else {
$level++;
$category = get_category($category - > category_parent);
return get_level($category, $level);
}
}
function display_cat_level($level = 0, $link = false, $parent = NULL) {
$catArgs = array('hide_empty' => 0);
if ($parent != NULL) {
$catArgs['child_of'] = $parent;
}
$cats = get_categories($catArgs);
if ($cats) {
foreach($cats as $cat) {
$current_cat_level = get_level($cat);
if ($current_cat_level == $level) {
if ($link == true) {
echo ''.$cat - > name.
"
";
} else {
echo $cat - > name.
"
";
}
}
}
}
}