Skip Navigation

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

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 5 replies, has 2 voices.

Last updated by mariaA-45 1 year, 10 months ago.

Assisted by: Long Nguyen.

Author Posts
June 27, 2023 at 3:57 pm #13904653

mariaA-45

Tell us what you are trying to do?
Translate my Kadence Elements

Is there any documentation that you are following?
https://wpml.org/documentation/translating-your-contents/using-different-translation-editors-for-different-pages/#how-to-use-manual-translation

Is there a similar example that we can see?
Yes, the translation isn't live yet. I can send a "temp login link", if you wish to take a look for yourself.

Describe the issue:
I feel that I am following the documentation linked above and yet, the manually translated element does not turn up. Perhaps that is because I include elements in page content by referring to them with their shortcode. For instance, I include a shortcode (to an element) in the bottom of many pages that pulls in the contents of that element representing a disclaimer (legal wording).
Now, after I translate some pages to a new language (with ATE), I don't manually adjust the shortcode on the resulting translated page to refer to the translated element. Is that correctly understood? Does WPML work out the alternative shortcode on its own?

Thanks,
Maria

June 28, 2023 at 4:35 am #13906703

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi Maria,

Thank you for contacting WPML support, I'd be happy to help you with this issue.

I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to a testing site where the issue is replicated. Your next reply is set to private to share the info.

Then let me know the steps so I can see the issue on your site.

❌ IMPORTANT: Please backup your database and website before proceeding ❌
You can use this plugin to create the backup:
https://wordpress.org/plugins/duplicator/
✙ I would need your permission to de-activate and re-activate Plugins and the Theme and to change configurations on the site if needed. This is also a reason the backup is critical.

Look forward to your reply.
Thanks

June 28, 2023 at 8:44 am #13908207

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I've done some steps below to display the translation of Kadence element on the frontend:

1. Use a custom XML configuration code to register Kadence shortcode for translation, you can see it in WPML > Settings > Custom XML Configuration.

<wpml-config>
  <shortcodes>
    <shortcode>
      <tag>kadence_element</tag>
      <attributes>
        <attribute>id</attribute>
      </attributes>
    </shortcode>
  </shortcodes>
</wpml-config>

2. Use a custom PHP code to display number in Advanced Translation Editor (ATE) to translate the shortcode attribute ID, you can see it in Snippets > WPML translate number. By default, the number value will not be available in ATE.

function wpmlsupp_7499_allow_translating_numbers( $is_translatable, $job_translate ) {
    $data = $job_translate['field_data'];
	if ( 'base64' === $job_translate['field_format'] ) {
		$data = base64_decode( $data );
	}
    if ( is_numeric( $data ) ) {
    	return true;
    }
    return $is_translatable;
}
add_filter( 'wpml_tm_job_field_is_translatable', 'wpmlsupp_7499_allow_translating_numbers', 10, 2 );

3. Edit the Kadence element in English language > Element settings > Show On: Entire Site. Please check this screenshot hidden link

4. Edit the page "Betingelser og Datapolitik" > Make a small change to the page content > Update > Update the translation.

5. In ATE > Search for the element ID "9718" and translate it with translation ID "27962" > Complete.

❌ IMPORTANT: Please backup your database and website before proceeding ❌

Refer documentation
https://wpml.org/documentation/translating-your-contents/page-builders/how-to-register-page-builder-modules-and-theme-options/
https://wpml.org/faq/how-to-translate-urls-shortcodes-and-html-attributes-using-the-advanced-translation-editor/

Let me know if it works on your side.

July 1, 2023 at 7:45 am #13926965

mariaA-45

Hi Long,

thanks for spending the time to get this to work. I do feel however, that this work around is fairly involved and I am concerned with the long-term maintainability. I did thus explore a different solution and I believe that my alternative is much easier, more straight forward and applies generally to Kadence Elements without any extra work from customer or WPML side. As a matter of fact, I feel that this alternative is much better than the official how-to (https://wpml.org/documentation/translating-your-contents/using-different-translation-editors-for-different-pages/#how-to-use-manual-translation) and the related forum article (https://wpml.org/forums/topic/translated-kadence-elements-fail-to-show/).

#####
The trick is to wrap all content residing in an existing Kadence Element into a "Reusable Block". Nothing else! No enabling "Translatable" for Kadence Elements, no classic translation interface, no content duplication, yada yada - none of that. Just a Reusable Block - that's it!
#####

Further comments:
All placement rules that can be configured for Kadence Elements (of course) still work and even shortcodes can be used to place Kadence Elements for instance on Product pages. WPML will automatically create a translation job for the Reusable Block as soon a page containing that Reusable Block is translated. The exception is shortcode placement of the Kadence Elements (for instance on Product Pages): using a shortcode, WPML doesn't automatically create the translation job for the Reusable Block. As a work-around, I create a private page containing all my Reusable Blocks as pure Reusable Blocks, i.e. not using any Kadence Elements placement mechanics, at all, and simply translate that page through WPMLs ATE. WPML will create translation jobs for all contained Reusable Blocks automatically and once these are translated (using ATE!), the translations of these Resuable Blocks will apply to all places where the Reusable Block was used - also when reference by a shortcode.

I haven't tested this solution very thoroughly, i.e. there might be scenarios, where additional work-arounds are necessary. I do feel however, that this is much easier to handle Kadence Elements than using the classic translation editor and what not...

Hopes this helps others out there!
Best,
Maria

WPML-KdenceElements.png
July 3, 2023 at 2:27 am #13930111

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

Thanks for sharing the workaround on your side. Feel free to create new tickets if you have more questions.

Have a good day 🙂