WordPress.org

Forums

Polylang
[resolved] Cant change menu (9 posts)

  1. enderoe
    Member
    Posted 2 years ago #

    Hi,

    I cant change what menu to display where. I the menu tab the polylang options overwrite the feature to change what menu to display where.

    Is there something i am overseeing?

    http://wordpress.org/extend/plugins/polylang/

  2. anton minchuk
    Member
    Posted 2 years ago #

    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?

  3. anton minchuk
    Member
    Posted 2 years ago #

    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...

  4. anton minchuk
    Member
    Posted 2 years ago #

    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 );
    
        } ?>
  5. anton minchuk
    Member
    Posted 2 years ago #

    also i've found that if i change the any of two menus' name to "main-menu" it will be displayed...

  6. Chouby
    Member
    Plugin Author

    Posted 2 years ago #

    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

  7. anton minchuk
    Member
    Posted 2 years ago #

    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?

  8. Chouby
    Member
    Plugin Author

    Posted 2 years ago #

    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...

  9. anton minchuk
    Member
    Posted 2 years ago #

    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!!!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Polylang
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.