0

I just would like to show my "footer menu" only with the two pages I manually added in appearance section:

register_nav_menu('footer', 'Footer menu');

enter image description here

but when loading in the footer:

 {!! wp_nav_menu([
            'menu' => 'Footer menu',
            'theme_location' => 'Footer menu',
            'menu_class' => '']
     ) !!}

it keeps listing all the pages, also taken from Primary one :(

any adivce?

ty

2 Answers 2

0

In my function:

    register_nav_menus(
        array(
            'menu-1' => esc_html__( 'Primary', 'mySite' ),
            'menu-2' => esc_html__( 'Secondary Menu', 'mySite' ),

        )
    );

And then in my header to display the menu:

<?php
wp_nav_menu(
array(
'theme_location' => 'menu-1',
'menu_id'        => 'primary-menu',
)
);
?>
0

theme_location is supposed to be the menu slug, not the label. You've given it the label.

For register_nav_menu('footer', 'Footer menu'); the menu location name is footer. So you need to use:

'theme_location' => 'footer',

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.