Support » Plugin: Polylang » [Plugin: Polylang] Pages in both languages in menue, subpages disappear

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

    (@chouby)

    What do you call standard menu ? In order for the menus to appear in the right language, you must setup one menu per language in the WordPress menus admin panel and then affect each menu to each language in the languages->menus panel.

    By standard menu I mean the page menue automaically built by the page structure of parent-child pages. This was the only way before the cusom menue was introduced in WordPress 3.0. The advantage of this way is that new pages are automatically added to the menu under its parent page. A custom menu can only be made by admin.

    Why doesn’t this work for multilingual pages? It is just to filter on language like for posts. And why is the Parent attribute removed?

    Plugin Author Chouby

    (@chouby)

    If I understand well what you mean, you refer to a menu created with the function wp_page_menu. On my test site, it works (does not mix languages and keeps the hierarchy).

    However, this function creates items with page-item class, whereas your site has menu-item class (as custom menus created in the WordPress menus panel). That’s why I asked you about what you call standard menu.

    So I would need more precisions on how you created your menu.

    Now the menu is a custom menu. I created two menues according to your instructions, and connected one to each language. But the menue does not switch when I switch the language. The only way to switch menu is by deactivating polylang and set the menu the normal way.

    I tested with the TwentyElleven theme and then everything worked. With and without custom menues. First I used an Artisteer generated theme (which is based on TwentyTen).

    What are the requirements to the theme to make it work?

    Plugin Author Chouby

    (@chouby)

    I do not know Artisteer. But of course, I am interested to know more in order for Polylang to be compatible with themes generated with Artisteer.

    Your problem remembers me a similar issue I faced some weeks ago. The plugin is not compatible with themes which hardcode the association between the theme location and the menu (by specifying the menu in the wp_nav_menu location with something like:
    <?php wp_nav_menu(array('menu' => 'menu-1', 'theme_location' => 'primary')); ?>
    in that case, it is necessary to remove the menu parameter.

    Is the menu coded like this with Artisteer ?

    I can not find it, but I am not a PHP programmer (thats why I use Artisteer). You can download one of my Artisteer generated themes if you like to look into it. They all have the same PHP code, only the css and images are different. If you find the problem I will report it to Artisteer. They have good support.

    Plugin Author Chouby

    (@chouby)

    I downloaded one of your theme and reproduced the bug.

    In fact, your theme calls directly a function called ‘get_pages’ to create the menu. In my opinion, it’s strange since it could be created with ‘wp_page_menu’ but why not.

    The problem is that Polylang does not filter the ‘get_pages’ function for performance reasons (but only functions which are known to call it such as wp_list_pages used in the pages widget).

    The good news is that, as far as I understood, ‘get_pages’ will be modified in WP 3.4 and the performance issue may be solved.

    The other good news is that waiting for this, I will propose you a small modification for your theme that will solve the issue. Edit the file library/navigation.php and at line 104 (just below function theme_get_list_pages…), add:

    $args['exclude'] = implode(',', apply_filters('wp_list_pages_excludes', array()));

    Thank you for good support! I tested the change, and now it works. What exactly is this line doing?

    Plugin Author Chouby

    (@chouby)

    In fact, the filter ‘wp_list_pages_excludes’ is normally used by the ‘wp_list_pages’ function to allow plugins to modify the list of pages to exclude. I currently use this filter to exclude pages which are not in the current language.

    Here, the line just asks to apply the same filter as in ‘wp_list_pages’. Thus Polylang as well as other plugins can exclude pages.

    As explained above, hopefully I will be able to do something more efficient with WP 3.4 (working directly with ‘get_pages’).

    Thanks for the line of code. It works with with the standard menue, but not with the custom menue. I have two languages “de” and “en” and it simply ignores the custom menue now.

    See: http://zappmatic.de/?lang=de and http://zappmatic.de/?lang=en

    For the test, I changed the order of the Items in the custom menue: First “Slideshow” second “Imprint” in both langugages. Nothing happens.

    Would be great to get a hint or a line of code to fix that.

    Thanks,

    G√ľnther

    PS: Some smaller issues I saw on the page – but I can work around that:
    1. The Language-Switcher doesn’t show up in the main menue
    2. If you switch the pages (not articles) they have article-metadata below the headline.

    Plugin Author Chouby

    (@chouby)

    @g√ľnther: Are you using Artisteer too ?

    @chouby: Yes, I use Artisteer. Latest Mac-Version 3.1.0 in Standard Edition.

    The same for me. It works with the standard menu, but not the custom menu. Since I use the standard menu, the solution solved my problem.

    Plugin Author Chouby

    (@chouby)

    Could you post a link to download your theme ? The artisteer theme I have from Stig Ulfsby Webdesign offers only pages or categories as menu source.

Viewing 15 replies - 1 through 15 (of 31 total)
  • The topic ‘[Plugin: Polylang] Pages in both languages in menue, subpages disappear’ is closed to new replies.