WordPress.org

Ready to get started?Download WordPress

Forums

Polylang
[resolved] menu not switching (9 posts)

  1. moreyummystuff
    Member
    Posted 8 months ago #

    Thanks for your time and what appears to be an excellent plugin!

    Using TwentyTwelve I cannot get the menus to switch - I've created the languages, assigned separate custom menus to them but when I switch language the menu remains the default language's menu (everything else switches language normally).

    I read the documentation and as far as I can tell the twentytwelve theme uses register_menu and wp_nav_menu in accordance to the requirements of the plugin.

    I checked that the "language" variable from bloginfo returns the correct language and indeed it does.

    What else should I look into?

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

  2. moreyummystuff
    Member
    Posted 8 months ago #

    Well one thing I did was to change the standard wp_nav_menu entry to:

    wp_nav_menu(array(
    'theme_location' => 'primary#' . pll_current_language()
    ));

    Now it swaps the menus properly for the primary location, but I'm pretty sure that's not the intended use.

  3. hgrat
    Member
    Posted 8 months ago #

    I have the same problem and moreyummystuff solution didn├Ąt work that good for me.

  4. Chouby
    Member
    Plugin Author

    Posted 8 months ago #

    I'm pretty sure that's not the intended use

    For sure not. Polylang is intended to be be fully compatible with default themes.

    Which versions of WordPress and Twenty Twelve are you using?

  5. moreyummystuff
    Member
    Posted 8 months ago #

    It's a brand new installation of WP 3.6 and twentytwelve is ver 1.2.

  6. Chouby
    Member
    Plugin Author

    Posted 8 months ago #

    Have you other plugins active which may conflict. Because I of course tested this configuration and got no issue.

    Could you explain how you did set your menus?

  7. moreyummystuff
    Member
    Posted 8 months ago #

    The only other plugin active was Advanced Custom Fields which hadn't been setup at all, nothing was defined for it. I tried disabling it but nothing changed.

    To setup the menus I went to Appearance->Menus->Manage Locations and assigned the two menus I had created to each language; english and greek in this case. If I go to "Edit Menus" it lists the assignments properly in the parenthesis next to the menu name in the dropdown.

    Previous to that I had added greek as an extra language without changing any of the settings that polylang suggested for the language (ISO code, locale, etc).

    In language settings I have:

    - Default language: english
    - Detect browser language: disabled
    - URL modifications: option 2
    - Hide URL language for default language: disabled
    - When using static front page, redirect the language page: enabled
    - Activate languages and translations for media: enabled

    I'll install WP & the plugin later on in a separate new installation and see if it works then with all default settings and compare options. Before I installed polylang I had made some changes to settings (pretty permalinks, etc), but even if I restore those to default currently there is no change. Also ACF was installed before I added polylang.

  8. Chouby
    Member
    Plugin Author

    Posted 8 months ago #

    Could you tell me which names you gave to your menus? Have you a link? Maybe this could help.

  9. moreyummystuff
    Member
    Posted 8 months ago #

    After taking a peek at the php error logs I found what it was. On my local dev machine, which this is on, I use symlinks for the plugin directories - apparently this line in polylang.php

    define('POLYLANG_DIR', dirname(__FILE__)); // our directory

    Resolves to the symlink target (__FILE__ behavior was changed after PHP 4.something) so as a consequence it silently failed to create the termmeta table on activation. However any subsequent queries to that table generated entries in the error log which gave it away.

    Setting the plugins to a normal directory and activating (after clearing previous installation db entries) works out fine.

    Again, thanks for your time.

Reply

You must log in to post.

About this Plugin

About this Topic