Skip to content

Instantly share code, notes, and snippets.

Created October 14, 2011 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1286065 to your computer and use it in GitHub Desktop.
Save anonymous/1286065 to your computer and use it in GitHub Desktop.
<?php
$category = get_the_category();
print_r($category);
$parent = get_cat_name($category[0]->category_parent);
if (!empty($parent)) {
echo $parent;
} else {
echo $category[0]->cat_name;
}
?></h1>
<ul>
<?php
if ( is_category() ) {
$current_cat = get_query_var('cat');
wp_list_categories('hide_empty=&title_li=&child_of='.$current_cat);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment