WordPress and current_menu_item

For some reason, menus within a widget in WordPress do not get assigned classes such as the “current_menu_item” class – on top of that, when adding a class to the menu item in Worddpress > Appearance > Menu, they are not assigned the respective classes.

I want to be able to assign a current_page_item class, or any class for that matter, to highlight a currently active menu item within a widget. I’m not sure why classes are omitted from menus within a widget, but i guess it’s an oversight from the developers or something.

Read More

Can anyone help me achieve the above?

Regards,
Nick.

Related posts

Leave a Reply

1 comment

  1. #access .current-menu-item > a,
    #access .current-menu-ancestor > a,
    #access .current_page_item > a,
    #access .current_page_ancestor > a {
        font-weight: bold;
    }
    

    This is where you’re styling your .current-menu-item to be bold. However, your menu on the left is not inside the access nav element. The current-menu-item class is on your active menu item:

    <li id="menu-item-40" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item menu-item-40"><a href="/jason/bill-payment">Bill Payment</a></li>