• xlrdxrevengex

    (@xlrdxrevengex)


    Ok so i have a menu bar with some links that have submenus i am using wordpress 3.0 menu system.

    If i click on PARENT 2 and load that page how can i display PARENT 2’s child or submenu. Or if i am on PARENT 3 show PARENT 3’s child or submenu.

    Not when hovered but when page is active. I know i need either a function like this

    function additional_active_item_classes($classes = array(), $menu_item = false){
    
        if(in_array('current-menu-item', $menu_item->classes)){
            $classes[] = 'active';
        }
    
        return $classes;
    }
    
    add_filter( 'nav_menu_css_class', 'additional_active_item_classes', 10, 2 );

    Or another function that looks at the parents classes to find the ACTIVE class and adds a new class in the sub menus class to show it

  • The topic ‘sub menu shown if parent is active’ is closed to new replies.