• Resolved jpl98

    (@jpl98)


    Compatibility with Polylang? Catlist selects articles from the default language. How to make separate lists for different translations?

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Contributor zymeth25

    (@zymeth25)

    I am not an expert on Polylang but I assume it creates separate posts for every language. So the easiest thing to do would be to add categories (or tags) corresponding to languages, you could then do things like [catlist id=1 tags="en"] or [catlist id=1 tags="fr"].

    Plugin Contributor zymeth25

    (@zymeth25)

    Or if you prefer not to clutter your blog with auxiliary tags and classes, you could add a custom field to each post indicating the language and then filter based on that. It is more hassle though.

    • This reply was modified 2 years, 9 months ago by zymeth25.
    Thread Starter jpl98

    (@jpl98)

    Thanks for your reply, zymeth,
    but List category seems to only “see” posts from the default language. On my ‘Archive’ page which uses [catlist] without parameters only articles in French are listed, while they are all translated into English.

    Plugin Contributor zymeth25

    (@zymeth25)

    Ok, I’ve had a glance at the Polylang docs. Now I need to know what it is exactly you are trying to achieve: do you want a list of all the posts in both languages or just that catlist display a list in the language of the current page?

    Thread Starter jpl98

    (@jpl98)

    Catlist display a list in the language of the current page, so I can make an Archive for each language. Thanks a lot,

    Plugin Contributor zymeth25

    (@zymeth25)

    Polylang determines the language from the main query. So to achieve what you are looking for it should be enough to use the LCP plugin with main_query=no added to your shortcode. This way the plugin will work in a proper secondary query mode and should play well with Polylang, in theory.

    Let me know how it goes.

    Thread Starter jpl98

    (@jpl98)

    A bit challenging for my very limited WP user abilities. By adding main_query=no in the short code of the page I only get this text before an unchanged list of posts.

    Plugin Contributor zymeth25

    (@zymeth25)

    Have you tried [catlist main_query=no]? What was the result?

    Thread Starter jpl98

    (@jpl98)

    Unfortunately I still have the list in the default language (FR)

    Plugin Contributor zymeth25

    (@zymeth25)

    Ok, I understand that the problem is in the Archive page that is accessible in the top menu of your site. That page exists only in the French version, if you open it and click the English icon you get redirected to the main page.

    So first you need to create a corresponding English version of the Archive page, same as you have done with all other posts and pages. Then, on that English page, the shortcode I suggested above should work.

    Thread Starter jpl98

    (@jpl98)

    The page exists, zymeth. I didn’t put it in English menu because it doesn’t work. The address is here:
    https://surimposium.rhumatopratique.com/archive-en/
    I just added it to the English menu but the only effect of [main_query=no] is to bring back to the main language menu (selecting the Archive EN page brings back to the French menu)

    Plugin Contributor zymeth25

    (@zymeth25)

    Have you set in Polylang options that this page is in English? It does not appear that you did because the address does not contain the /en/ like all the other Polylang English pages you have.

    Like with these two pages:

    Note the /en/ in the address of the English version. The address of the English archive you sent me above does not contain it which indicates it is not a proper English version set in Polylang.

    Again, I am not an expert on Polylang but this is an obvious misconfiguration.

    • This reply was modified 2 years, 9 months ago by zymeth25.
    Thread Starter jpl98

    (@jpl98)

    Oh thank you very much zymeth, you found the error. It’s not catlist that was in question but actually the fact that I created the page directly instead of translating the one into French via the Polylang plug-in. The page is normally translated now, with the same catlist code as the French page. Kudos for your expertise.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘How to list different languages?’ is closed to new replies.