Menu problem
-
Hello! I’m trying to add language option to my website. I’ve coded my theme and I need to show the web in three different languages. I’ve got the little flags and I’ve managed to pass a php variable with the language it’s selected. With that variable I’ve made a if for the wp_nav_menu assignment in the header.php. It works actually. When I change the language the correct menu in the correct language comes up. The problem is that when I hit in a menu item and the selected page opens the menu is gone. Disappears. Can anybody help me, plase? Here is the code I use.
In header.php
if ($language == 'es') { wp_nav_menu(array( 'theme_location' => 'spanish', 'container_class' => 'main-nav', 'container' => 'nav' )); } else if ($language == 'en') { wp_nav_menu(array( 'theme_location' => 'english', 'container_class' => 'main-nav', 'container' => 'nav' )); } else if ($language == 'de') { wp_nav_menu(array( 'theme_location' => 'german', 'container_class' => 'main-nav', 'container' => 'nav' )); }
And in the functions.php
add_theme_support ('menus'); //Create Nav Menu if (function_exists ('register_nav_menus')) { register_nav_menus (array( 'spanish' => __('Spanish menu'), 'english' => __('English menu'), 'german' => __('German menu') )); }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Menu problem’ is closed to new replies.