[Resolved] Core html block with shortcode not translateable
This thread is resolved. Here is a description of the problem and solution.
Problem:
Core html block with shortcode not translateable
Solution:
Shortcodes having numbers in their attributes can either be found in the string translation (search for the number value) or add the following code in your theme's functions.php file to be able search/translate in ATE:
Hi there,
I use the core html block to integrate shortcodes on my site. Like this:
[fluentform id="2"]
[kadence_element id="1311"]
When I translate the page, the core/html block is not visible. When I use the wpml search to search for example the shortcode "fluent" (see my attached images) I can only find a fraction of the shortcode. I tried to search "2" or 1311 but without success.
1. It is not possible to translate the content of a html block. I tried it with different ones.
2. Instead of the html block I tried it with the core shortcode block. But it is the same.
3. I used string translation to search the shortcodes. I found them and translated them. BUT when I update the page, my translated strings are resetted...
4. Is it somehow possible to show all the content in the advanced translation overview?
it is not possible out of the box via WPML, since the shortcode and numbers should be same on the translated page. Also translating the page via WPML string translation will not work, that is expected.
Anyway, you can use a small workaround from the next ticket:
- Add the correct XML code for this shortcode
- Add custom function code function wpmlsupp_7499_allow_translating_numbers
- Add your shortcode to text block wrapped in HTML
Hi,
is it possible to make the standard gutenberg HTML block available for translating? I have different shortcodes added with the html block with different shortcodes. Is there a better solution to edit every page and add <div></div> to all gutenberg html blocks? I Don't use the automatic translation option and want to be able to change the content of the gutenberg html blocks.
If this doesn't resolve the problem, then I need to take a closer look at your site. So I request temporary access (WP-Admin and FTP), preferably to a test site where the problem has been replicated.
Your next answer will be private, to share this information safely.
Also provide detailed steps to reproduce the issue and links to pages in admin and on frontend.
IMPORTANT: Please take a complete backup of the site to avoid data loss.
I checked in your staging site and added those shortcodes in 2 different pages:
- Test WPML -> using Shortcode Blocks
- Test wpml 2 -> using Custom HTML Block
Then I was able to find the IDs and attributes of these in String Translation (see attached).
I translated these pages also and experimented the translated ID for dearpdf shortcode at hidden link. For German page I used 99999999 while translated for English using 888888888. And I can see the ID correctly used on the frontend (see attached).
Then translated the page and I could see in ATE (see attached ate.jpg). I used 77777777 this time and could see it reflected on English translation also (see attached), which was reflected in ST also (see ate-st.jpg).
So I think it is working fine, please check and confirm.
IM SO SORRY! Totally my fault I have to add:
add_filter( 'wpml_tm_job_field_is_translatable', '__return_true' );
otherwise I'm not able to translate the strings.
5star support. Please adjust my rating.
IM SO SORRY!