I have function that check what is main top category of post. So i have category tree like this
Foo
-bar
--foobar
cat2
and if post is in foobar, my function post_is_in_descendant_category shows me "foo" and i can style that post with style-foo.css. What i want now is to make this same possible for styling category page "foobar". Wordpress functions in_category works only for posts.
So, my code if ( in_category( 'foo' ) || post_is_in_descendant_category( get_term_by( 'name', 'foo', 'category' )) || is_category('56') ) doesn't work for subcategories.