I have hierarchy like this:
Category1
-Subcategory1
-Subcategory2
–Post1
Category2
-Subcategory1
I need to show subcategories name and description when i go to category//// Now i use this code:
<?php if (is_category()) {
$this_category = get_category($cat);
if (get_category_children($this_category->cat_ID) != "") {
echo '<div id="catlist"><ul>';
$childcategories = get_categories(array(
'orderyby' => 'name',
'hide_empty' => false,
'child_of' => $this_category->cat_ID
));
foreach($childcategories as $category) {
echo '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a>';
echo '<p>'.$category->description.'</p>';
}
echo '</ul></div>';
}
}
?>
Now i have subcategories list when click on category and blank page if i click on subcategory link but i need to show posts when i click on subcategory list.