I want to display the direct category ancestor of a given post. An illustrative example:
These are the categories I have:
Cat1
Cat2
Cat2.1
Cat2.1.1
Cat2.1.2
Cat2.2
Cat2.2.1
Cat2.2.2
Cat2.3
Cat3
Cat3.1
Cat3.1.1
Cat4
I check the whole trailing, like in:
Cat1
[X]Cat2
[X]Cat2.1
Cat2.1.1
[X]Cat2.1.2 <-my post
Cat2.2
Cat2.2.1
Cat2.2.2
Cat2.3
[x]Cat3<
[x]Cat3.1
[x]Cat3.1.1 <-my post
Cat4
So I have 'my post'
assigned to a multiple categories. Lets say I am navigating to 'my post'
like this : Cat3->Cat3.1->Cat3.1.1->my post
. Now, in the single post page, I want to display the name of the direct category ancestor of 'my post'
(Cat3.1.1
in this case). But the question is how to do this?