Anyone that uses the WPML plugin with the WPTouch Pro plugin that has found issues in getting the main menu to switch languages when the site language is switched will find this code useful.
- Create a menu in the wordpress admin with a unique name example: “Mobile Sites Nav”
- Create the translated version of that menu for each of your languages.
- Find the menu.php file in your theme folder.
- add the code in red. note I am only showing for the language versions below. You will need to add a line for each language your site supports.
<ul>
<?php
$MenuName = ‘Mobile Site Nav’;
if(ICL_LANGUAGE_CODE==’en’){ $MenuName = ‘unique nav name’; }
?>
<?php if(ICL_LANGUAGE_CODE==’es’){$MenuName = ‘unique nav name’; }
?>
<?php if(ICL_LANGUAGE_CODE==’canada’){ $MenuName = ‘unique nav name’; }
?>
<?php while ( wp_nav_menu( array(‘menu’ => $MenuName )) ) { ?>
<?php wptouch_the_menu_item(); ?>
<?php if ( !wptouch_menu_is_disabled() ) { ?>
<li>
<a href=”<?php wptouch_the_menu_item_link(); ?>”>
<?php if ( wptouch_can_show_menu_icons() ) { ?>
<img src=”<?php wptouch_the_menu_icon(); ?>” alt=”" />
<?php } ?>
<?php wptouch_the_menu_item_title(); ?>
</a>
<?php if ( wptouch_menu_has_children() ) { ?>
<?php wptouch_show_children( ‘menu.php’ ); ?>
<?php } ?>
</li>
<?php } ?>
<?php } ?>
</ul>
Let me know if you found this useful.

