WordPress.org

Ready to get started?Download WordPress

Forums

Custom menu item not getting current-menu-item class added (7 posts)

  1. rwwood
    Member
    Posted 4 years ago #

    I'm using a modified twentyten theme and want to style the menu item for the currently viewed page different from the rest. I created a menu with a mixture of pages and categories and one custom link for "Home". All of the items are getting the current-menu-item class applied properly except for the Home link.

    If anyone can tell me what I might need to change, it would be much appreciated.

    Thanks.

  2. Michael Bishop

    Posted 3 years ago #

    This may be a bug. I've discovered it with a default menu widget. .menu-item-home doesn't also get .current-menu-item when on the page defined in that link.

  3. Bradford
    Member
    Posted 3 years ago #

    I found on my site that by including the trailing / it worked. However on another site it isn't working, but that's maybe because there's a bunch of stuff following the url. If you're simply pointing it to your home page include the trailing slash and that might work.

  4. jami0821
    Member
    Posted 3 years ago #

    Adding a trailing slash "/" at the end of the custom menu URL worked for me too.

  5. karlevid
    Member
    Posted 3 years ago #

    seems like you need to use full url with the http://... works for me now.

  6. creativeworldstudio
    Member
    Posted 3 years ago #

    @karlevid - Happy to also confirm adding http://... to the start of the custom link prompts WP to add the correct 'current' and 'ancestor' etc. classes. Thanks!

  7. tonesfrommars
    Member
    Posted 3 years ago #

    I just dealt with this same issue.
    I found that not only did I have to add http://..
    But also the http://www..

    Not sure if the trailing slash was needed or not, but there you go.

Topic Closed

This topic has been closed to new replies.

About this Topic