• Resolved vfxman

    (@vfxman)


    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:
    https://monkeyhut.com.au

Viewing 15 replies - 1 through 15 (of 19 total)
  • 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.

    Thread Starter vfxman

    (@vfxman)

    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.

    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.

    Thread Starter vfxman

    (@vfxman)

    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.

    Thread Starter vfxman

    (@vfxman)

    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*

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

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

    https://www.nexusenergycenter.org

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

    Thread Starter vfxman

    (@vfxman)

    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 ??

    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

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

    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.

    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; }

    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;
    }

    @geek

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

    Thanks,
    Daniel

    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.

    https://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).

    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;
    }
Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘multiple current_menu_item on home page after upgrade to wordpress 3.3’ is closed to new replies.