james_barrett
Member
Posted 1 year ago #
Quick question.
I have a menu system that an arrow chases your mouse and stays on the selections that you click. But gets broken when you get to a search page.
It either does not work or if I code an else if then all of the li's get a class of selected. I need it to stay on the li that was selected when you searched. Please look at my code and tell me what I am doing wrong.
Code Snippet
Any help on this would be great.
Thanks,
James
Why not just use the built-in WordPress Menus feature? It will automatically add class "current" or "current_menu_item" when you're on that page.
Instead of all that code you just need to put wp_nav_menu();
Although that won't solve the actual question you asked, which is when you do a search how do you keep the previous active page still marked as "selected". I don't know how to do this, or why you would want to do this. That page isn't selected, so why would you want to mark it as such?
james_barrett
Member
Posted 1 year ago #
I was thinking about it and I don't really need to do that. I am just going to reset the navigation back to the Home tab. But thank you for looking at this for me.
Thanks again,
James