Problem with showing two menus

Question

Hello I try to show two menus in a single page in WordPress 5.3 using WampServer64 on Windows 10:

functions.php

add_theme_support('menus');
function register_my_menus() {
    register_nav_menus(
        array(
            'top-right' => __('Top Right'),
            'top-left' => __('Top Left')
        )
    );
}
add_action( 'after_setup_theme', 'register_my_menus' );

header.php

wp_nav_menu(
    array(
        'theme-location' => 'top-right'
    )
);

wp_nav_menu(
    array(
        'theme-location' => 'top-left'
    )
);

Setup in WordPress (Appearance > Menus)
Menu 1 Setup

Menu 2 Setup

Results (comments in red)
Results

How can I show menu1 (“Hello World!”) on the right and menu2 (“Sample Page”) on the left? Is this a bug?

0
, , Kyun 2 years 2019-11-24T06:11:33-05:00 0 Answers 75 views 0

Leave an answer

Browse
Browse