The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Get category name in current category (2 posts)

  1. Filespit
    Posted 3 years ago #

    Hello there. I'm having trouble displaying the category name while browsing a specific category. Let's say I add a post and give it two categories, for example "Food" and "Music". Then when I visit the post on my site, I want only one of the categories to be displayed. Displaying only one I know how to do, but it always picks the first alphabetically correct category. Is there a way to control which category I want to display?

    Also, if I go to mysite.com/category/food and click on a post there, I want the displayed category to be "food", but if I click on the same post through /category/music, I want the displayed category to be music instead. Is there a way to work around this or is it not possible?

  2. bcworkz
    Posted 3 years ago #

    It's all possible, but tracking down all the details needed to implement it could be somewhat involved. First you would have to modify the category meta box so you can somehow indicate which category should be the primary category. Then you'll need your own list categories tag that knows about this designation, but also knows to look where the link request came from so it can substitute the appropriate category when necessary.

    I think I get where you're coming from for this, but from a user perspective, this concept seems a bit dishonest, like you're hiding information from me. You're misrepresenting which category something was assigned based on which route I followed to the post. Showing all the categories gives me more opportunities to explore related topics on your site. Something to consider? Not that what I think matters at all for your site :)

Topic Closed

This topic has been closed to new replies.

About this Topic