This thread is resolved. Here is a description of the problem and solution.
Problem:
Translate Kadence shortcode
Solution:
https://wpml.org/documentation/translating-your-contents/page-builders/how-to-register-page-builder-modules-and-theme-options/
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: Compatibility
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? Is there any documentation that you are following? Is there a similar example that we can see? Describe the issue: Thanks, |
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 ❌ Look forward to your reply. |
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 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/). ##### Further comments: 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! |
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 🙂 |