Support » Themes and Templates » knowing in which category a user was when he clicked on a post
9 years, 1 month ago
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
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 ?
It’s true, it should work where the user IS, not where he was.