• Resolved bazz

    (@lucicmirko)


    Hi! Great plugin but I have some problems with menu.

    I read other topics about this problem but I didn’t find solution.

    In case I set wp_nav_menu this way:
    wp_nav_menu(array('menu' => 'Top Menu', 'container' => '', 'fallback_cb' => 'wp_page_menu', 'echo' => false, 'depth' => 2));
    I have problems:
    -No home page link
    -When I change language, content language is changed but menu language don’t change

    In case I set wp_nav_menu this way:
    wp_nav_menu(array('theme_location' => 'Top Menu', 'container' => '', 'fallback_cb' => 'wp_page_menu', 'echo' => false, 'depth' => 2));
    – No home page link
    – In menu now I have alphabetically ordered pages in that language (it ignore custom menu I made)

    Any solutions?

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chouby

    (@chouby)

    The first code will not work because if you hardcode the menu, then Polylang will intentionally let it unchanged.

    The second should work because it sets the theme_location and not the menu. However I did not test all combinations of arguments.

    The following code works for sure:

    <?php wp_nav_menu( array('theme_location' => 'primary' ) ); ?>

    Once you have created your different menus, just go to the Settings->languages->menus page and assign the different menus to the theme location (in your case ‘Top menu’, for twenty ten ‘primary) and each language.

    You can add / remove arguments to check which one breaks things.

    NB:
    ‘fallback_cb’ => ‘wp_page_menu’ is useless as it is the default value.
    Custom nav menus do not create the home link automatically (not linked to Polylang). You must explicitly add it.

    Thread Starter bazz

    (@lucicmirko)

    Theme I used have some ‘strange’ functions for displaying menu.
    I deleted it and added in functions.php

    register_nav_menu( 'primary', 'main_menu' );

    And in header.php file of my theme:

    <?php wp_nav_menu( array('theme_location' => 'primary' ) ); ?>

    Probably I will add more arguments to wp_nav_menu() but now everything works fine 😀

    Thank you for your time!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: Polylang] Problems with menu’ is closed to new replies.