Quantcast
Channel: wp_nav_menu (secondary menu) not adding current classes - WordPress Development Stack Exchange
Viewing all articles
Browse latest Browse all 3

wp_nav_menu (secondary menu) not adding current classes

$
0
0

I've looked everywhere, but i can't find a solution.

My secondary menu isn't adding any current classes to the

  • tags when it's rendered.

    I have added this menu in my functions.php file

    function register_menus() {
        register_nav_menus(
            array(
                'second-menu' => __( 'Second Menu' )
            )
        );
    }
    

    Then I created a menu in wordpress with the links I want to show in my Second Menu. After that I've added the menu with the function wp_nav_menu in the .php file where I want the menu to show:

    <?php wp_nav_menu( array( 'theme_location' => 'second-menu' ) ); ?>
    

    So far everything works. The menu is showing with the links I want it to show. All the links are working. My problem is, that the 'current' classes which WP normally adds to the menus aren't added to this menu. I've expected the classes current-menu-item or current-page-item to the

  • tag, but these aren't there. The only classes which WP adds to the
  • tag are:
    • menu-item
    • menu-item-type-post_type
    • menu-item-object-page
    • menu-item-[number]

    Thanks for the help, Angelo


  • Viewing all articles
    Browse latest Browse all 3

    Latest Images

    Trending Articles





    Latest Images