WordPress.org

Support

Support » Themes and Templates » knowing in which category a user was when he clicked on a post

knowing in which category a user was when he clicked on a post

  • Hello; I’m building a custom menu with highlighting of the items, etc.

    All is working fine when the user is browsing pages or categories. (I use conditions like “if (is_category(‘cat1’))”, etc.)

    The problem is that it’s difficult for posts :
    a post can be attached to several categories, so it’s hard to highlight the one I want…

    My idea was to use
    $_SERVER[‘REQUEST_URI’];
    split it and isolate the $cat var.

    But the problem is that, when you click on a post, the content of $_SERVER[‘REQUEST_URI’]; is not the previous page but the actual one (I guess it’s because of the wordpress template system).

    So, is there another way to proceed ?
    Thanks !

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘knowing in which category a user was when he clicked on a post’ is closed to new replies.
Skip to toolbar