WPML Compatibility thread

Hi @JohnF , OK, thanks for the details. Is great to know that it seems to be compatible by default with WPML, even if it isn’t officially.

Thank you!

Hi @JohnF, for pages are you just using WPML’s string translation to maintain styling?

No, we are simply duplicating the pages. I do not like to use String translation because if you change juste 1 caracter in the original language, then you loose the whole translation….

Also, content created using string translation can’t be exported if you ever decide to change your builder 3 years from now…

Which conditions you use for your templates?

1 Like

Hi!

Anyone knows how to show one element based on language page condition?

I am building a multilingual site with WPML. The header has been handled very well, as Bricks+WML are showing the proper menu in each language. But I need to translate a small text on the header manually, and I would like to do it via a condition.

I would like to get something like this, but in Bricks Builder and with WPML: Polylang condition in Oxygen: how to use one template for different languages

Is that possible?

Thanks!! :slight_smile:

Insert this PHP code into your functions.php and then you will have the ability to select Dynamic data > WPML Language Slug in your condition settings. From there, use the language slugs to show or hide the element.

2 Likes

Hi @zestjosh!

Thanks for your help!

I have followed your instructions, but it is not working for me. So I may have done something wrong!

Here is my step by step:

1 - I have uploaded your code via WPCodeBox as a PHP snippet and enabled it:

2 - Then I have edited my footer template, and add three text blocks. One is for English, another one for French and a last one for Catalan. Catalan is the main language, and the other two are translations.

3 - I have set a condition on the English version, like this:

4 - I have also done this for the French version and the Catalan one:


When looking in the frontend, all I see is the Catalan version.

Any ideas of what I am doing wrong?

Thanks!!

Based on the last screenshot, the issue may be that the conditions are set to OR instead of AND. Try hitting the + button at the bottom of the first condition and recreate the second condition ({wpml_language_slug} != fr) and then remove the last condition.

Hi @zestjosh !

Thanks for trying to help me out!

I have changed the OR condition to and AND condition, but in the frontend I am having the same (wrong) result.

The Catalan version is the one that have the AND condition to show this text when the wpml_language_slug is not ‘fr’ nor ‘en’:

The English text has the condition to show when the wpml_language_slug == en, and the French text when the wpml_language_slug == fr.

However, in the frontend I am still only getting the Catalan text in all three versions of the website (Catalan, English and French).

Any ideas?

Thank you!!

Could you try putting {wpml_language_slug} inside of a Basic Text element to ensure that it is working properly? Additionally, you could try switching the statements to check if {wpml_language_slug} == ca

I added {wpml_language_slug} inside a Basic Text and it is not working:

I have tried it in a Template and in a Page, and it does nothing. Also I have added your php code into functions.php on my child theme, instead of using WPCodeBox, but nothing changes :confused:

I just reviewed the code in my Gist and realized that a piece was missing and I just added lines 42-48! Sorry about that, just update the code and it should work as expected now.

Thanks for your efforts!!

However, I have copied your new code and it doesn’t work either :frowning_face:

get the same result as before. The condition returns to “false”, because in the frontend I don’t see any text in any language when {wpml_language_slug} == en (or fr or ca).

Hi! I arrive here thru other threat.
I just want to let you know that you can do the same with an included WPML function.
That mean that you don’t need to add any code, just put the function in the dynamic data

Here the function:
{echo:icl_get_current_language()}

4 Likes

Hi, I am building a multilingual site using Bricks, WPML, and LearnDash to build a course.
WPML works fine on pages, but for WPML I have to create a template inside bricks to show the course, lesson and topics pages.

The problem is that when I am inside the LearnDash lesson for example and I change to English I see the video content but without any other LearnDash settings, like the progress bar, next lesson button, mark as complete…etc

Any ideas?

Hi, would you mind to tell us how you translate your pages? I’m building a bilingual site using wpml now, but somehow my layout & content are not appeared on translated pages. I try to edit the translated page in bricks despite the wpml warning (they want me to edit via wpml translation editor), but nothing appear on frontend still.

Aside from that, my header template are working in both languages, even without using conditions or create separate templates.

I’m using wpml & bricks latest version on my site.

Thank you!

Hi. You cannot use the WPML translator editor.
You have to duplicate pages and do the translation in every new page

Ah I see. Thank you so much @marcorubiol ! You’ve made my day! It’s now working. For anyone who maybe face any difficulties like I am, here are what I did after I duplicate the page in original language.

*Browser will refresh and a note ‘(duplicated)’ will appear on wpml column on the page, along with ‘pencil’ icon. Click the ‘pencil’ icon.
*The browser will load a wpml translation editor window with a warning popup. Choose ‘Edit Independently’.
*Translated all content available as usual, don’t forget to check to mark it as complete. Then choose ‘Save & Close’. It’s done!
*(optional) If you already create a menu based on the original page, you may need to synchronize the menu so the translated menu will appear on the header.

I’m using Bricks 1.8.5, ACF Pro 6.2.0 with WPML 4.6.5 (& strings translation & AFCML addon). All working properly up to this point.

Another tips:
*Before translating any page, make sure to finish creating/editing the layouts in Bricks. Any Bricks edits after duplicating the page will not appear on translated version. If this happens, you need to detach the translated version to None and delete it, then repeat the process to duplicate the original version page.
*Use ACF/Metabox/Custom Field for all text inside the page that needs to be translated. If there are any revision in the future, you can easily update it via wp backend & translate it via wpml translation editor.

Again, kudos for @marcorubiol.

1 Like

Current problems:

  • Link: Link type internal post/page-> links to main language always, not to translated.
  • WooCommerce page (cart,checkout etc.) translations is not working. Main language loads always.
  • WPML settings update links for translations → not working.

I have same issue using field type url in ACF. I ended up use text field type then translate the link manually. Thankfully it works.