Referring to posts in multiple categories

by thomsonson   Last Updated September 11, 2019 12:08 PM

I have posts assigned to multiple categories, as in this example:

Post 1 > Cat A, Cat B
Post 2 > Cat A, Cat B, Cat C
Post 3 > Cat B, Cat C

The posts are accessed via category pages, and on the posts content.php template part I would like to show the name of the category page that the post was accessed from, for example:

Post 1 > accessed from Cat A > post shows 'Cat A'
Post 1 > accessed from Cat B > post shows 'Cat B'

However no matter what I've tried so far, the posts always show the name of the first (lowest ID number) category.

Is there a way to make the post template to dynamically show the relevant referring page/category?



Related Questions



using quantity as an attribute

Updated August 29, 2017 09:08 AM

Category structure

Updated January 02, 2018 09:08 AM


problem with filter of custom portfolio categories

Updated March 07, 2019 23:08 PM