WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] multiple current_menu_item on home page after upgrade to wordpress 3.3 (20 posts)

  1. vfxman
    Member
    Posted 2 years ago #

    Yesterday I upgraded from WordPress 3.2.1 to 3.3. After doing so, my menu (which was working previously) now has a problem whereby multiple current_menu_item and current_page_item styles are added to the custom menu items which have nothing entered in URL field.

    The problem only occurs on the Home page; once you navigate to any other pages the menu works as expected.

    I notice that if I add something into the URL field of the custom menu items through the menu editor, ie: #, that it now works as expected and doesn't add the current_menu_item. Unfortunately, this is not ideal, as I don't want these menu items to indicate to the user that they are clickable, as an anchor might imply...

    Can anyone help me solve this mystery? I'm out of ideas and can't work out what has changed in the upgrade that would cause this, especially since it only occurs on the home page!??!!?

    The URL in question is:
    http://monkeyhut.com.au

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    Have you tried:

    - deactivating all plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    - switching to the Twenty Eleven theme to rule out any theme-specific problems.

    - resetting the plugins folder by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause problems.

  3. vfxman
    Member
    Posted 2 years ago #

    Yes, I've done all those things. Switching theme to Twenty Eleven does not rule out theme-specific problems though, because that theme does not output the same menu code like in my theme, so I can't tell whether the problem occurs or not...

    Deactivating all plugins and renaming the plugins folder does not fix the problem.

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    Switching theme to Twenty Eleven does not rule out theme-specific problems though, because that theme does not output the same menu code like in my theme

    Then it sounds like it's a theme problem.

  5. vfxman
    Member
    Posted 2 years ago #

    Well possibly, but not necessarily. The fact that entering anything into the URL field for the custom menu item fixes the problem makes me suspect it's a bug with the way wordpress 3.3 handles empty url fields in custom menu items..?

    I mean, it was working fine before the upgrade to 3.3.

  6. vfxman
    Member
    Posted 2 years ago #

    The thing I don't understand is how the problem only occurs on the Home page. Every other page works as expected..? What is different about Home when compared to Contact, for instance..? *baffled*

  7. Prasanna SP
    Member
    Posted 2 years ago #

    It's happening with other themes as well. I've tested about 10 themes in my test site, and the same thing happened with all the themes.. So I suspect, it is a WordPress issue. :-(

  8. rickytherhino
    Member
    Posted 2 years ago #

    @vfxman - I am having the exact same problem you and Prasanna are having. Tried everything listed to no avail.

    http://www.nexusenergycenter.org

    It has to be a WP problem but I don't know how to fix it. If I can...

  9. vfxman
    Member
    Posted 2 years ago #

    Glad I'm not the only one having the problem, but it is does sound like it could be a WP issue. If any of you discover a fix, please let me know! My menu looks so ugly at the moment :(

  10. GeekSpecialties
    Member
    Posted 2 years ago #

    Yep, same issue here. In my screenshot I'm on the Home page, Portfolio is a blank url field for a dropdown.

    If I look at the generated classes on the Portfolio item class=
    menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-64

    http://dl.dropbox.com/u/41218/wp-current-item-issue.jpg

  11. jfRaima
    Member
    Posted 2 years ago #

    What I did was not a fix but a decent substitute until someone finds a real answer. I input the first item in the dropdown menu's url to the custom navigation link.

    Example:
    Products
    - Hats
    - Gloves
    - Coats

    The url that I input for the custom link, "Products" is the url for the "hats" page.

  12. GeekSpecialties
    Member
    Posted 2 years ago #

    This is what I did to fix the display for now.

    The home page adds a class to the body tag named home.
    So you can target that menu item while on the home page then just style it as it should be, not as the current-item styles.

    Mine uses two background images so here is what I changed them to.

    .home li#menu-item-64.current-menu-item { background-image: none; }
    .home .sf-menu > li#menu-item-64.current-menu-item > a { background-image: none; }
  13. GeekSpecialties
    Member
    Posted 2 years ago #

    Oh yeah, and need to add a hover action back on.

    .home .sf-menu > li#menu-item-64.current-menu-item:hover, .sf-menu > li.sfHover {
        background: url("../images/buttons_small.png") no-repeat scroll 0 -166px transparent;
    }
    .home .sf-menu > li#menu-item-64.current-menu-item:hover > a, .sf-menu > li.sfHover > a {
        background: url("../images/buttons_small.png") no-repeat scroll 100% -199px transparent;
    }
  14. rickytherhino
    Member
    Posted 2 years ago #

    @geek

    Pardon the ignorance but what file is that in? Where should I edit it?

    Thanks,
    Daniel

  15. GeekSpecialties
    Member
    Posted 2 years ago #

    It will be in the css style sheet for your theme.
    Usually at the root of your theme.
    /wp-content/themes/yourtheme/style.css

    Advanced themes may have additional style sheets, but the above is where you can add new styles to overide the problem ones.

    Your exact styles will be different depending on your current menu/theme.
    If you use the firebug addon for Firefox you can right click on the offending menu item, select inspect element. It will show you the classes applied to that item and their location.

    http://dl.dropbox.com/u/41218/wp-current-item-issue-firebug.jpg

    The problem is it's applying the class "current-menu-item" to a menu item that is not the current page. In my case "menu-item-64" (portfolio dropdown in previous posted screenshot).

  16. petemurray
    Member
    Posted 2 years ago #

    I've had the same problem and fixed it in a different way.

    Custom menu items on home page with a blank URL have the class 'current-menu-item' added to them (this is the bug), so the chances are your theme will style them to look as if they are selected

    So, I changed the menu item link from a blank URL to '#' which stopped the class 'current-menu-item' being added and then used the CSS below to make the cursor not a pointer.

    .menu .sf-menu  a[href="#"]
    {
    cursor:text;
    }
  17. vfxman
    Member
    Posted 2 years ago #

    Does anyone know if this bug has been officially reported to the WordPress dev team?

  18. silverks
    Member
    Posted 2 years ago #

    This issue has been fixed in WP 3.3.1

  19. vfxman
    Member
    Posted 2 years ago #

    Great news!

  20. Hugo
    Member
    Posted 2 years ago #

    I'm running WP 3.3.1, and this problem still remains for me. Two menus, top and bottom, both get .current_menu_item for every page except the root (using static start page in Settings).

    Using twentyeleven widgetized menu btw.

Topic Closed

This topic has been closed to new replies.

About this Topic