PHP menu – Currently selected page bug
-
Hi,
I’ve recently started messing around with WordPress and i’m trying to make my own portfolio site using it.
I’ve got a lot to do! but I’ve got a problem with my menu…I’ll try to explain
This is my test site:
https://johnmillington.co.uk/foliotest/
When you click a menu item the code in the header reads what page the user is on and then if it matches it changes the id of the link to “a1”.
So for example if you go on the contact page the button realises the page title is set to contact and gives the contact button a class of “a1” which makes it show that as the highlighted page.
The problem is that if you click contact for instance and then before the next page has loaded move your mouse off the button, then hover over any other button it keeps contact highlighted but also expands the button you’re hovering over. I’d rather have it so when you hover over another button the currently selected page goes back to normal.
I’m useless at php but I have an idea of what the solution would be, i’d need code for each button that activates on hover and sets all other button ids to another id (anything but “a1”), that way when a button is hovered over it would set the rest to be non-highlighted.
Here’s my current code:
[Code moderated as per the Forum Rules. Please use the pastebin]
If anyone knows how to fix this or can come up with another way of having highlighted links i’d be very grateful!
Thanks ??
John
- The topic ‘PHP menu – Currently selected page bug’ is closed to new replies.