简体   繁体   中英

how to select a different menu using wp_nav_men on wordpress

I have this problem with switching from a menu to another I have already registered many menus on my functions.php file and I tried to put them in the header file, but what is happening is that my new menu that was created it is just included inside of the old one that I had before, what I want is when I select a new menu this menu will replace the old one. When I try to switch menus because my website is supposed to be multilingual then when I select a flag in Portuguese it is supposed to change the menus to Portuguese and all content go to Portuguese, but my menu in Portuguese is going inside of my menu in English when I wanted this to be replaced.

in the header I have included this code inside the tag nav

wp_nav_menu(array('theme_location' => 'main', 'fallback_cb' => '', 'walker' =>  'Bunyad_Menu_Walker'));  
wp_nav_menu(array('theme_location' => 'portuguese-p'fallback_cb' => '', 'walker' =>  'Bunyad_Menu_Walker')); 

You have a typo in your second definition:

wp_nav_menu(
    array(
        'theme_location' => 'portuguese-p',
        'fallback_cb' => '', 
        'walker' =>  'Bunyad_Menu_Walker'
    )
); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM