Display the Top Parent (Root) category of a post as a title?
I have a post, this post is in 3 categories. The category hierarchy is like so:
Fashion being the “root/top parent” category for the post. I want to display a title at the top of the post which says “Fashion”.
I have tried “get_the_category” but this brings back an array in alphabetical order, I need only the root category which in my case is “Fashion”. So this is no use. I have tried “single_cat_title” but this brings back nothing.
Any ideas on how to get the top category displayed as a title?
- The topic ‘Display the Top Parent (Root) category of a post as a title?’ is closed to new replies.