• Resolved cybup

    (@cybup)


    Hello,

    It seems like the WordPress Navigation Menus are not displayed for Custom Post Type archive (i.e. mydomain.com/?post_type=my_custom_post_type) when Polylang ‘Hide URL language information for default language’ is set.

    It was detected on WP3.3.1 with Network/Multisite and Polylang 0.7.1.

    Another bug report that relates to this exact ‘Hide URL…’ setting was discussed here.

    Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter cybup

    (@cybup)

    In addition, when the ‘Hide URL…’ setting is NOT set but the ‘Displays a language switcher at the end of the menu’ is set then Polylang Language Menu is not displayed for Custom Post Type archive (i.e. mydomain.com/?post_type=my_custom_post_type).

    Please notice that both issues I reported here don’t happen for regular post/page.

    I propose you the following quick fix:
    Edit include/core.php at line 293 and replace:

    (isset($qvars['post_type']) && $qvars['post_type'] && is_archive()) ))

    by

    (isset($qvars['post_type']) && $qvars['post_type'] && is_archive() && $qvars['post_type'] != 'nav_menu_item') ))

    Please tell me if it solves your problem.

    Thread Starter cybup

    (@cybup)

    It solved the first problem and now the Navigation Menus are displayed properly however it didn’t solve the second problem with Polylang Languages Switcher.

    Could you give me more details about the second issue ? I do not reproduce it. I guess there is something wrong in your description because ‘mydomain.com/?post_type=my_custom_post_type’ is an url that you should not reach if you don’t hide the language code in the url.

    What are your permalinks and language settings ?

    Thread Starter cybup

    (@cybup)

    I did some more tests and it seems to happen when the permalink setting is the default (i.e. http://localhost/?p=123). It does NOT happen if the permalink setting is Custom Structure. This should probably point you to the root cause…

    In any case, here are the settings you asked:
    Wordpress Settings->General->Site Language=English
    Wordpress Settings->Permalink->Default (http://localhost/?p=123)
    Settings->Languages->Settings->Default Language=English
    Settings->Languages->Menus->
    – Displays a language switcher at the end of the menu = Set
    – Displays language names = Set
    – Displays flags = Set

    I did more tests too and I believe that I understand what happens.
    Important points are that you are using default permalinks and you don’t hide the language code in the url for the default language.

    Thus when looking for mydomain.com/?post_type=my_custom_post_type (but you could obtain the same result with other types of archives such as mydomain.com/?m=2012), you are looking for a page which should not exist. At least your site should not create such link.

    Since this query means something for WordPress (without Polylang) a page is displayed (all the custom post type archive in all language). But since there is no language set in url, Polylang does nothing (it generates errors though).

    Although the site should not create such links, I should redirect to the 404 page.

    Thread Starter cybup

    (@cybup)

    Replacing /?post_type=my_custom_post_type with /?m=2012 results in redirecting to 404 page…

    The same for me if I did not wrote anything in 2012. But If I wrote one or more posts in 2012, all are displayed (whatever the language), no language is set (the theme is displayed in the WordPress default language) and the language switcher is not displayed in the menu.

    Anyway this will be corrected in 0.7.2

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Polylang] – Navigation Menus and Hide URL language setting’ is closed to new replies.