Viewing 15 replies - 16 through 30 (of 31 total)
  • collaborato

    (@collaborato)

    Sure, here ist the theme:

    dl.dropbox.com/u/1535331/assistentinhamburg.zip

    I’m using custom menus (with pages) configured in polylang like you can see here:

    dl.dropbox.com/u/1535331/menue.png

    Plugin Author Chouby

    (@chouby)

    I downloaded your theme and will come back with a solution.

    luneya

    (@luneya)

    I would like to thank you, Chouby, for your help on the Artisteer theme issues!
    I had the same problem as Stig and your line of code helped me (only it was line 100 in my theme, but I just put it directly below the function theme_get_list_pages($args = array()) { and now it works!
    Now I just need to figure out where to put the flags to change languages ??

    Thanks again! I love the polylang plugin, it has saved me loads of time making a site tri-lingual ??

    Plugin Author Chouby

    (@chouby)

    @collaborato

    I got it ! The motto of Artisteer development team should be : “Why making things simple when we can make them complex !”. Almost 400 lines of code when WordPress allows you to create a menu with only one line !

    First I needed to make some code modifications to Polylang that will be included in 0.7.2. You can try it before the release by downloading the current development version.

    Second, you need to modify the Artisteer code again. Everything is in the file library/navigation.php. The goal is to setup the ‘wp_nav_menu_items’ filter in the correct way.
    At line 21, replace:

    return theme_get_list_menu($args);

    by

    return theme_get_list_menu($args + array('theme_location' => key(get_nav_menu_locations()))); // adds a missing argument to wp_nav_menu_items filter

    At line 98, replace:

    $items = apply_filters('wp_nav_menu_items', $items, $args);

    by

    //$items = apply_filters('wp_nav_menu_items', $items, $args); // wrong place to call this filter which must be called *inside* the <ul> tags

    At line 319, just before:

    if (theme_is_empty_html($output)) return '';

    Add:

    $output = apply_filters('wp_nav_menu_items', $output, (object)$args); // the filter must be called inside the <ul> tags and with $args supplied as an object

    Thus, the custom menu should work and you should be able to add the language switcher to it.

    Plugin Author Chouby

    (@chouby)

    @luneya

    You cannot add the language switcher to the pages menu (it’s not linked to Artisteer). You can only add it to a custom menu. See what I wrote above to adapt Artisteer for custom menus.

    Of course you can use the provided widget or use the function pll_the_languages if you are ready to modify the php code of your theme.

    luneya

    (@luneya)

    Hey Chouby,

    I used the line of code provided in the documentation: <?php pll_the_languages();?> to put it inside the header. Only issue I’m having is that it’s displaying the language names instead of the flags (I just want the flags without text. It’s not showing the flags at all).

    When I use the widget, it uses the flags. But I can’t place the widget inside the header ??

    Plugin Author Chouby

    (@chouby)

    You did stop to the FAQ and did not follow the “documentation link”. All parameters are documented page 9. If you want the flags only:

    <?php pll_the_languages(array('show_flags'=>1, 'show_names'=>0));?>

    luneya

    (@luneya)

    Ah man, totally my bad! I did read the documentation.
    I was screwing around with the syntaxes (i’m not very experienced with object ori?ntated!). I couldn’t figure out how to specify two parameters (the example used is one parameter and looking back now, I see the comma is used in slightly different examples further down) but I get it now ??

    Thank you for patiently answering my OOP-noob behind ??

    Plugin Author Chouby

    (@chouby)

    I will add this example with two parameters ??

    collaborato

    (@collaborato)

    @chouby: Thanks a million for the quick support. I will check that out later and get back to you.

    Greetings!

    Thread Starter Ulfsby Webdesign

    (@sulfsby)

    After upgrading to 0.8.1 the fix in the Artisteer theme for standard menu no longer works.

    Plugin Author Chouby

    (@chouby)

    I have no issue on my side (with the Blue Ribbon theme I kept modified as described above).

    Hi Chouby,

    I have created my own theme but encounter the similar issue. https://hoovit.com/hedgespa/wordpress/?p=asdas
    This issue only occur if the post/cat is string, which does not generate a 404 …

    There are 2 problems with the page:
    1. wp_nav_menu fall back to wp_page_menu and display all pages in 2 languages.
    2. within the theme, I used get_page, that also breaks, not sure how … This is how it should look
    https://hoovit.com/hedgespa/wordpress/

    Can I know if there are any way to fix it ?

    Plugin Author Chouby

    (@chouby)

    I will correct the /?p=asdas issue in the future release. Without Polylang, you get the list of the latest posts. With Polylang, you will get the same in the default language. However I need to make further tests to be sure I dont break other things before releasing it.

    Are you using ‘get_page’ or ‘get_pages’ ? ‘get_page’ should work without any issue provided that you pass a valid page id. ‘get_pages’ is currently not automatically filtered by the current language, since there is no convenient filter in WordPress to do it. The only existing filter would oblige me to double the number of queries ?? I was hoping that 3.4 would improve this, but it will not be the case.

    Hi Chouby, thank you so much for your support !!!

    I think i have solved the second problem. My code used pll_get_post to get the id:
    get_page(pll_get_post($id));
    This, however cause the problem mentioned above (which is cannot get the page id). And when i try to put in the optional Language parameter, it works.
    get_page(pll_get_post($id,$lang));
    I guess it has the same root cause of the first one ? The language is not detected ??

    Anyway, really appreciate your support. Will looking for your future release. Really useful plugin ??

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