- This topic has 8 replies, 2 voices, and was last updated 8 years, 4 months ago by Tom.
-
AuthorPosts
-
November 5, 2015 at 10:44 am #150764Adrian Cojocariu
Hey man.
I’m having a little issues.
I have a big local single page website, but I also have the blog page, which is separate.
In the menu I use directly custom links #hashtag to the anchor, but when I’m on the blog page, they won’t work, because the anchors don’t exist there.
So I have to put http://www.domain.com/#hashtag but when I do this, the items get highlighted in the navigation, like a blog post that can be found in more than one category …
How can I make it so they’re not highlighting ?
I’ve tricked it by doing .blog .main-navigation {display:none} and adding a duplicate secondary nav with onle #hashtag instead of full URL, and disabled the secondary nav from the homepage… but it kinda sucks, there are still two completely duplicate menus …
November 5, 2015 at 11:41 pm #150850TomLead DeveloperLead DeveloperCan you show me an example of a menu item highlighting when it shouldn’t?
Your best bet may be to do what you’re doing with the two menus.
November 6, 2015 at 12:48 am #150884Adrian CojocariuSure.
This won’t happen on any of my other test sites !
Just here… the highlighted menu item is a menu link with full url http://www.domain.com/#anchor
the others are just #anchor
Tell me what you think about the side, btw π
November 6, 2015 at 10:16 am #151028TomLead DeveloperLead DeveloperThis is happening because WordPress matches your homepage URL and the menu item URL – if both match to the homepage, they highlight that menu item as the current menu item.
In this case, I do think you’re better off using two separate menus.
Site looks great! Really like it π
November 6, 2015 at 2:03 pm #151067Adrian CojocariuBut Tom, why doesn’t this happen to other websites with older versions ?
like methodseeker.com
I do have the annotation in the content area and the full url in the menu…
November 6, 2015 at 2:04 pm #151068Adrian CojocariuSame here
methodseeker.com/emirose/#coafura
November 6, 2015 at 2:14 pm #151076TomLead DeveloperLead DeveloperI couldn’t tell you why really, all I can tell you is that it looks like WordPress is trying to be smart by highlighting the menu item because the URL is equal to your front page URL.
If you were to remove the front page URL (http://www.emirose.ro/) from the menu item, it won’t highlight.
This is just WordPress being WordPress – sometimes it’s very convenient, as we usually want the “Home” menu item to be highlighted when we’re on the homepage – it’s just in this case it’s not what we want.
You can always just tell it to look normal:
#menu-item-47 a { background-color: transparent; color: white; } #menu-item-47 a:hover { color: #c6394f; background-color: #f9e8e3; }
November 6, 2015 at 2:55 pm #151079Adrian CojocariuAhhh yes ! Thank you very much ! That’s a lot better than using the duplicate menu system. It’s strange it won’t happen on the other sites. The thing is, the full URL anchor reloads the page on the other sites instead of just jumping to it, so it triggers the animations every time, which I don’t like.
Thanks Tom.
November 6, 2015 at 11:17 pm #151118TomLead DeveloperLead DeveloperYou’re welcome π
-
AuthorPosts
- You must be logged in to reply to this topic.