WordPress.org

Support

Support » Plugins and Hacks » Polylang » [Resolved] Cant change menu

[Resolved] Cant change menu

Viewing 8 replies - 1 through 8 (of 8 total)
  • anton minchuk

    @anton-minchuk

    same problem. Always the default language menu is displayed. When i switch the language, i have same old default language menu. Can you fix it?

    anton minchuk

    @anton-minchuk

    if to be correct. The firs menu i have created is displaying. No other menus are displayind despite of settings. theme – sofa suppastore, link on site http://www.buyboots.com.ua/ – it is still in deep construction. Also there is no language switcher in menu, but i’ve checked the menu switcher feature…

    anton minchuk

    @anton-minchuk

    it seems to me that my menu is calling by function in such way:

    <?php if( has_nav_menu( 'main-menu' ) ) {
    
            $menu_defaults = array(
              'menu'            => 'main-menu',
              'container'       => 'div',
              'container_class' => 'dropmenu upper',
              'container_id'    => 'globalnavi',
              'menu_class'      => 'navigation',
              'menu_id'         => 'dropmenu',
              'echo'            => true,
              'fallback_cb'     => '',
              'before'          => '',
              'after'           => '',
              'link_before'     => '',
              'link_after'      => '',
              'depth'           => 0,
              'walker'          => '',
              'theme_location'  => '' );
    
     	wp_nav_menu( $menu_defaults );
    
        } ?>
    anton minchuk

    @anton-minchuk

    also i’ve found that if i change the any of two menus’ name to “main-menu” it will be displayed…

    Plugin Author Chouby

    @chouby

    Polylang works only if the theme correctly uses the ‘theme_location’.
    If you get the menus tab then it means that the theme registered the nav menu (generally in functions.php but complex themes may put this in another file) with something like:

    register_nav_menus( array(
    	'primary' => __( 'Primary Navigation', 'twentyten' ),
    ) );

    so in that case, you just have to replace the line

    theme_location'  => '' );

    by

    'theme_location'  => 'primary' );

    This may not be ‘primary’ but something else for your theme

    anton minchuk

    @anton-minchuk

    OK i tried to replace the string with ‘theme_location’ => ‘primary’ ); but after that no any menu is displayed.

    i found the code in one of theme file with register_nav_menus it looks like:

    function register__menus() {
    	register_nav_menus(
    		array(
    			'main-menu' => __( 'Main Menu' ),
    			'optional-menu-one' => __( 'Optional Menu One' ),
    			'optional-menu-two' => __( 'Optional Menu Two' ),
    			'optional-menu-three' => __( 'Optional Menu Three' ),
    			'optional-menu-four' => __( 'Optional Menu Four' ),
    			'optional-menu-five' => __( 'Optional Menu Five' )
    		)
    	);
    }

    what else can be done about that?

    Plugin Author Chouby

    @chouby

    You must not use ‘primary’ which is the example I gave, but ‘main-menu’. You have probably other places with wp_nav_menu, with theme_location not set, where you will have to set it with ‘optional-menu-one’, ‘optional-menu-two’, etc…

    anton minchuk

    @anton-minchuk

    OMG! You are like Moses for me now! Thank you a lot-lot-lot! And please take my deepest gratitude for your great plugin and your precious help!!!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Cant change menu’ is closed to new replies.
Skip to toolbar