Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is experiencing an issue where Dynamic Rules for hiding/showing content in Elementor and Anywhere Elementor Templates are not translating correctly after translating a French site into English. Specifically, flags next to product names are not appearing on the English version of the site.

Solution:
We recommend the following steps to resolve the issue:
1. Navigate to the

.../wp-content/plugins/anywhere-elementor-pro/includes/modules/dynamic-rules/module.php

file.
2. Locate line 723.
3. Replace the existing line of code:

$value = $rule['ae_rule_' . $key . '_' . $post_term_types . '_value'];

with the following code:

$value = $rule['ae_rule_' . $key . '_' . $post_term_types . '_value'];<br />foreach ($value as $wpml_tag_id) {<br />$wpml_translated_ids[] = apply_filters('wpml_object_id', $wpml_tag_id, 'product_tag');<br />}<br />$value = $wpml_translated_ids;

After making these changes, please check the templates on the front end to see if the issue is resolved.

If this solution does not seem relevant to your situation, please open a new support ticket with us.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 21 replies, has 3 voices.

Last updated by Andrés 1 year, 3 months ago.

Assisted by: Osama Mersal.

Author Posts
December 21, 2023 at 11:29 pm #15113499

andreS-25

Hi ! I have many Dynamic rules to hide/show contents in Elementor templates and Anywhere Elementor Templates. I have just finished translating a french site in English. On the engliah side the Dynamic Rules (conditional logic) is not translating :
Ex : hidden link you see flags next to the product name but in english they do not appear...

I have been trying to debug this for a while but I'm getting nowhere.

December 24, 2023 at 10:56 am #15123471

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for contacting WPML forums support. I'll be glad to help you today.

First of all, sorry for the late reply; it was due to a higher workload. Please log in to this sandbox site and install the Anywhere Elementor plugin. (hidden link)

After that, please try to replicate the issue. If the issue is replicable, please let me know how to reproduce it.

Best regards,
Osama

December 27, 2023 at 3:15 am #15131034

andreS-25

Its Holidays here, I will try to replicate tomorrow. Thanks.

December 27, 2023 at 9:10 am #15131334

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Sure, please take your time and let me know when you replicate the issue.

Best regards,
Osama

December 28, 2023 at 7:16 pm #15135671

andreS-25

Hi ! I started to try and replicate the problem but its so intricate and there are so many moving pieces (ACF, CPT, AE, Elementor Templates, Custom products... ) would it be possible for you to log in to the site and have a look ?

I have backed up the site..

Thanks

André

December 28, 2023 at 7:24 pm #15135672

andreS-25

BTW I have deactivated all plugins except for WPML, AE, Elementor and Woocommerce and the issue is still there.

December 28, 2023 at 7:40 pm #15135682

andreS-25

Hi again, upon further inspection, this is the missing translated value (see screen capture, The value should be "Lebanon" the English version of "Liban", it is a CPT added product Taxonomy).
To get the capture I changed the language to the problematic one (English) and edited the AE template with Elementor instead of the WPML translator.

I could do the fix manually but I rather have it done properly..

Capture d’écran 2023-12-28 143544.png
December 29, 2023 at 10:40 am #15136356

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Please let me know an example of the problematic pages/templates.

Also, I would need to look closely at your site, so I would need to request temporary access (WP-Admin and FTP)
Preferably to a test site where the problem has been replicated.

Your answer will be private, meaning only you and I can access it.

❌ Please backup your database and website ❌

✙ I would need your permission to de-activate and re-activate the Plugins and the Theme and change configurations on the site. This is also a reason the backup is critical.

✙ I also need your permission to take a local copy of your site to debug the issue without affecting your live site.

Best regards,
Osama

December 30, 2023 at 4:53 pm #15138145

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi André,

Thanks for the access details. I checked this template and tried to register the Anywhere rules using XML. (hidden link)

I've added the following code to WPML-> Settings-> Custom XML tab

<wpml-config>
  <elementor-widgets>
    <widget name="icon">
      <fields>
        <field>enable_dynamic_rules</field>
        <field>ae_show_hide_on_rules</field>
        <field>ae_dynamic_rules</field>
        <field>ep_display_conditions</field>
      </fields>
      <fields-in-item items_of="ae_dynamic_rules">
        <field>ae_rule_post_term_types</field>
        <field>ae_rule_post_term_produits_value</field>
        <field>ae_rule_post_term_couleur_value</field>
      </fields-in-item>
    </widget>
    <widget name="image">
      <fields>
        <field>enable_dynamic_rules</field>
        <field>ae_show_hide_on_rules</field>
        <field>ae_dynamic_rules</field>
        <field>ep_display_conditions</field>
      </fields>
      <fields-in-item items_of="ae_dynamic_rules">
        <field>ae_rule_post_term_types</field>
        <field>ae_rule_post_term_pays_value</field>
      </fields-in-item>
    </widget>
  </elementor-widgets>
</wpml-config>

After adding the above code, I updated the default language template and its translation. When checking the translated template using Elementor, I can see the rules there, but they didn't appear on the front end.

Please try replicating a simple rule on the sandbox site without ACF; just show or hide some elements according to user roles or terms.

If the issue is replicable, please let me know to consult our compatibility team.

Best regards,
Osama

December 30, 2023 at 5:49 pm #15138157

andreS-25

Actually, as I said in the previous message the bug #2 is created without ACF, using only product tags as base for dynamic content.

I you click one of the red buttons, 2 links slide in in French but not in English and are triggered only by product tag dynamic rules: IF current query is "Azienda Agricola Meroni (Italie)" Product tag THEN Show text. These will be activated even without the ACF plugin being active.

Thanks

Archive produit.png
December 31, 2023 at 8:19 am #15138428

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for your update. I installed WooCommerce in the sandbox with dummy products. Could you please create a simple archive template with the same rules on the sandbox?

I tried to use the user role rule, but it works correctly with logged-in/out users. (hidden link)

Thanks for your cooperation

Best regards,
Osama

January 2, 2024 at 7:27 pm #15144554

andreS-25

hidden link

this is taking sooo long 😉

André

January 3, 2024 at 7:48 am #15145369

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi André,

Thanks for replicating the issue. I really appreciate your cooperation. I've consulted our compatibility team, and I'll update you as soon as I get their reply.

Thanks,
Osama

January 6, 2024 at 11:35 am #15156651

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for your patience. I've just received our compatibility team's reply. Please check the following steps:

1- Open .../wp-content/plugins/anywhere-elementor-pro/includes/modules/dynamic-rules/module.php file
2- Look for line 723
3- Replace the following line

$value           = $rule[ 'ae_rule_' . $key . '_' . $post_term_types . '_value' ];

With

$value           = $rule[ 'ae_rule_' . $key . '_' . $post_term_types . '_value' ];
foreach ($value as $wpml_tag_id) {
$wpml_translated_ids[] = apply_filters('wpml_object_id', $wpml_tag_id, 'product_tag');
}
$value = $wpml_translated_ids;

After that, please check the templates on the front end.

I've applied this workaround on the sandbox site, please check if it works as expected.

Best regards,
Osama

January 7, 2024 at 4:14 pm #15157641

andreS-25

Not working on the sandbox, not working on the staged... furthermore for what I'm seeing the fix targets only product tags but the problem I have is widespread, not only on product tags...

I am leaving for a 3 weeks vacation tomorrow.... I really would have liked to fix this before I go... Its a live site after all. Thanks