I'm using WordPress 2.8.4.
My question is, if I'm viewing a sub category (cat-slug-2
in this example) is there a built in function to get it's category ID and its parents category ID?
Here's an example URL, where cat-slug-2
is a sub category of cat-slug-1
http://www.foo.com/category/cat-slug-1/cat-slug-2/
Thanks for the answer Manzabar, from your code i was able to modify it to get what i wanted.
Ultimately, I wanted an array of the category's parentIDs. Here's how I did it:
Note that $cat holds the current categoryID
Maybe something like this?
For more info on the WP Functions/Template Tags used above, see single_cat_title and get_category_parents.