WordPress.org

Ready to get started?Download WordPress

Forums

is_category() highlights too many elements (2 posts)

  1. andrzejkala
    Member
    Posted 4 years ago #

    I'm having a problem with WordPress "is_category()" and "in_category()" functions. I do understand why this is happening, but it turns out that it's not what I am looking for.

    I need to highlight one of the tabs that are located in the main navigation element. When a post is added only to one category the problem doesn't occur (which is understandable). It turned out though that the client wants some posts to be published in multiple categories and that's where the problem starts to shine.

    http://dev.andrzejkala.com/fabryka-diet/category/fitness/

    The problem also persists when I do enter a particular post that is in multiple categories.

    http://dev.andrzejkala.com/fabryka-diet/2010/04/08/test-x/

    Is there another way to highlight only currently selected category (in this case - "fitness")? Or maybe I am approaching the problem from a wrong direction?

    Thanks for any help in advance.

  2. sparro
    Member
    Posted 4 years ago #

    As far as I've seen there isn't any way to separate this. I had hoped to do the same with some of my sites, but couldn't make it work.

Topic Closed

This topic has been closed to new replies.

About this Topic