By Adrian Mummey in php, programming, template, wordpressMar 11th, 2009 | 6 Comments
Recently I had a problem where I needed to find out if a specific category was a descendant of another category, or if one category was a ancestor of another. The latest website I am working on has a top level category called “Trips we do” and below that are many sub-categories and sub-sub categories etc. I wanted to use the same template on all of the categories that were descended from the “Trips we do”.
Wordpress already has a function that returns the parent categories get_category_parents but this returns a string more suited for breadcrumbs. I needed a yes or no answer...