Category Ancestor is a plugin that adds a function you can use anywhere in your theme : get_category_ancestor($thecat) retrieves the highest level parent of any category.
It can be used for styling posts or category pages for groups of categories.
Up to now, you had two ways to check if a category was a part of a group of categories :
- Create an array, and test with category__in
- Test if category A was ancestor of category B
With Category Ancestor, you have directly the Ancestor, and you can have it as a slug, which is much more readable than an id number.
You can use it for tests, or to add a specific class.
Used in combination with custom fields, Category Ancestor can help you manage pseudo contents types.
I use it for example on a travel repertory, where we have several categories for hotels, and want to style all of them in a specific way.
The plugin can be downloaded on its blog post