Multilingual WPML looper

How to create a “blog” page, with loopers, in a multilingual website with WPML?

I created a looper for the blog pag (also for archives and others with custom post type), and then I need to translate it (the site is multilingual).
The problem is with the url used to link each post in the loop: {{dc:post:permalink}}: with this, the translated “layout” with the looper generates URLs like “mydomain.com/the-post”, without the language directory like “mydomain.com/en/the-post” (so that links always put you in the default language).

How can I generate links with the language directory in the looper?

Hello @llribas,

Thanks for writing in! Your Blog index will automatically display all of the translated posts. For example, if you have http://example.com/blog/, the translated blog index will become http://example.com/en/blog/. Only those posts that were already translated will display in the blog index.

The permalinks of the translated posts will always abide by the WPML. This means that the Looper Provider also abides with the WPML displaying the permalinks coming from the WPML translated permalinks. If the URL of your post is http://example.com/post-name and the translated URL is http://example.com/en/post-name, the Looper Provider will also display the same.

Hope this makes sense.

Hello,

In WPML configuration I have “Translatable. Use the translation if available or the default language”. Usually this generates a blog listing with links like http://example.com/en/post-name regardless the post is translated or not, so the user keeps browsing in the selected language.

With the looper the links in the posts listing (the blog page) are all without the language like http://example.com/post-name

Hey @llribas,

What Looper Provider are you using? On my site, I tested the Recent Posts and Query Builder looper providers and the translated layout links to the other language. It required no extra setup.

Please give us the following info in a Secure Note for us to investigate further:

  • URL of your main language blog and the translated blog page
  • WordPress Login URL
  • Admin username and password

You can find the Secure Note button at the bottom of your posts.

Thanks.

For the “blog page” there is no looper provider, the loop is provided because it’s the main “blog” page defined in wordpress “Reading” options (and as explained by you in your forum, to make the pager work).

But also I have a looper provider at the front page in language “catalan” (at the bottom of the page), in this case it’s a “query builder” looper provider, and the URLs of the links of the posts are also without the language directory (so getting you to the default language).

You have the credentials in the secure note.

thank you

Hi @llribas,

I have checked your website and found that you have created a single layout and assigned it to the Blog Pages, but didn’t add the content for the different languages. I went ahead and created it for English language by clicking into the Flag at the Bottom Right corner and adding the Author name to differentiate. I would suggest you create the same for all the languages and check if that works for you.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.