Hi,
I am working on a template that uses different navigation bars for different categories. When displaying category pages (archive.php) I have no problems finding out which category navbar to display. This is the code I use in header.php:
if (is_category()):
$catID = get_cat_id(single_cat_title('', FALSE));
$actualcat = get_category($catID);
if ($actualcat->parent != 0):
$catID = $actualcat->parent;
endif;
...
However, if I am in single.php I cannot find a way to get the categories of the post. This is the complete code I intend to use:
if (is_home()):
wp_list_categories('title_li=&depth=1');
else:
if (is_category()):
$catID = get_cat_id(single_cat_title('', FALSE));
$actual_cat = get_category($catID);
if ($actual_cat->parent != 0):
$catID = $actual_cat->parent;
endif;
elseif (is_single());
HOW DO I GET THE CATEGORIES
endif;
wp_list_categories('title_li=&depth=1&child_of='.$catID);
endif;
Any ideas?