Some of my posts are added to multiple categories. For example, I have a parent category "Colours", with sub-categories "Red", "Blue" and "Green". One of my posts, "Purple", is added to both "Red" and "Blue" categories.
So the hierarchy would be as follows:
That all works fine. The trouble I'm experiencing is getting the active sub-category ID when viewing the Purple page (single.php template) from within either of its multiple categories.
I need to know, when viewing http://www.example.com/colours/red/purple, that the sub-category is "Red". get_the_category() is useless in this instance because it returns category ID's for both "Red" and "Blue".
To be more specific, I'm trying to build a dynamic breadcrumb (mirrored as a page title) that contains the full hierarchy (as illustrated by the permalink).
AFAIK, this question has come up a number of times but remains unanswered. Any help would be appreciated, thanks.