user2624198
user2624198

Reputation: 1

Wordpress shows wrong custom menu

When I'm trying to show either one of my secondary menus in Wordpress it will display the primary menu ('main-menu') again instead of 'footer-menu' or 'info-menu'. I use the following code to display my menu:

                wp_nav_menu( array(
                    'theme-location' => 'info-menu',
                    'depth'      => 1,
                    'container'  => false,
                    'menu_class' => 'nav-info',
                    'fallback_cb' => 'wp_page_menu')
                );

And I registered my menus in function.php:

function register_my_menu() {

    register_nav_menus(
        array(
            'main-menu' => __( 'Main Menu', 'ibasketball' ),
            'footer-menu' => __( 'Footer Menu', 'ibasketball' ),
            'info-menu' => __( 'Info Menu', 'ibasketball' )
        )
    );
}
add_action( 'init', 'register_my_menu' );

Any help is much appreciated.

Upvotes: 0

Views: 805

Answers (2)

Vidya L
Vidya L

Reputation: 2314

You have a typo in your code theme-location should be theme_location Try wp_nav_menu(array('theme_location' => 'info-menu')); it will work

Upvotes: 1

Jothi Kannan
Jothi Kannan

Reputation: 3358

From codex, there is only one parameter available in register_nav_menus

Usage

 <?php register_nav_menus( $locations ); ?> 

Parameters

$locations

(array) (required) An associative array of menu location slugs (key) and descriptions (according value).
Default: None

Refer codex for more detail codex

Upvotes: 0

Related Questions