[Resolved] Anchors highlighted in navmenu

Home Forums Support [Resolved] Anchors highlighted in navmenu

Home Forums Support Anchors highlighted in navmenu

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • #150764
    Adrian 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 …

    Lead Developer
    Lead Developer

    Can 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.

    Adrian Cojocariu


    The original website

    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 πŸ˜€

    Lead Developer
    Lead Developer

    This 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 πŸ™‚

    Adrian Cojocariu

    But 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…

    Adrian Cojocariu

    Same here


    Lead Developer
    Lead Developer

    I 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;
    Adrian Cojocariu

    Ahhh 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.

    Lead Developer
    Lead Developer
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.