How to display sub-categories depending on what category you’re in.

Arhh, it took me a while, but I finally figured this out. Decided to share 🙂

$cat = get_the_category();
$cat_id = $cat[0]->category_parent;
if($cat_id != 0 && !is_home()) {
wp_list_categories("title_li=&child_of=$cat_id");
}

1 comment

  1. How do you actually implement this?, Is this something you put in functions, or do you paste this in the Sidebar. Not sure where to put the code

    Much help is very appreciative.

    Thanks

    Shawn

Leave a Reply

Your email address will not be published. Required fields are marked *