Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Polylang support

$
0
0

Replies: 0

Hello. I am using an older version of your plugin (before rewriting the code) and through searching this forum I was able to make it work with Polylang. Based on the answer here in support I use code like this:

if (get_locale() == 'cs_CZ') {
        //Display the Czech left menu
	wp_nav_menu( array(
                    'menu'            => 'my-menu-l-cz',
                    'items_wrap'      => '<ul id="mobmenuleft" class="%2$s">%3$s</ul>',
                    'container_class' => 'menu rounded',
                    'container'       => '',
                    'fallback_cb'     => false,
                    'depth'           => 3,
                    'walker'          => new WP_Mobile_Menu_Walker_Nav_Menu( 'left' ),
                ) );	
    } else {
       			
                //Display the Default left menu
                wp_nav_menu( array(
                    'menu'            => 'my-menu-l-en',
                    'items_wrap'      => '<ul id="mobmenuleft" class="%2$s">%3$s</ul>',
                    'container_class' => 'menu rounded',
                    'container'       => '',
                    'fallback_cb'     => false,
                    'depth'           => 3,
                    'walker'          => new WP_Mobile_Menu_Walker_Nav_Menu( 'left' ),
                ) );

The same was for the right menu.
However, the new version of your plugin works differently. I found code (class-wp-mobile-menu-core.php – line 507:

     if ( '' !== $current_menu ) {
            // Display the menu.
            $output = wp_nav_menu( array(
                $menu_param   => $current_menu,
                'items_wrap'  => '<ul id="mobmenu' . $menu . '">%3$s</ul>',
                'fallback_cb' => false,
                'depth'       => $mobmenu_depth,
                'walker'      => new WP_Mobile_Menu_Walker_Nav_Menu( $menu, '' ),
                'echo'        => false,
            ) );

It seems that this code handles displaying both, right and left menu together. So, if I replace $current_menu with for example ‘my-menu-l-cz’, both, the left and the right menu shows this menu. Could you help me with what condition to use or how to separate the left and right menu so that I could use the Polylang condition and make it work?
Many thanks


Viewing all articles
Browse latest Browse all 59525

Trending Articles