Wordpress provides conditionals like is_home() and is_category(). I'd like a function to tell me if the current context belongs to a category that is a subcategory (so, not a parent).
I tried this, but it returns true on any category (and subcategory) context
function is_subcategory($category) {
if (is_category()) {
foreach ($category as $c) {
if ($c->parent > 0) {
return true;
}
}
return false;
}
}