Skip Navigation

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

Problem:
The client is trying to translate a shortcode from the ARPrice plugin, which is not natively supported by WPML. They have followed the instructions for translating custom shortcodes with WPML and added custom XML code to the

wpml-config.xml

file and a filter to the

functions.php

file of their theme, but they are unable to find the ID in the advanced translator.

Solution:
We recommend the following steps to translate the shortcode:
1. Create a page and insert the shortcode.
2. Navigate to WPML->Settings->Custom XML Configuration and add the provided XML configuration:

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

3. Add the filter

add_filter( 'wpml_tm_job_field_is_translatable', '__return_true' );

to the theme's

functions.php

file.
4. Return to the page, make a minor edit, and update it (this step is crucial).
5. Add or edit the translation and search for the shortcode ID, such as '100'.

If you're experiencing this issue, we recommend trying the steps above. However, if the solution does not apply to your case because it might be outdated or not relevant, we suggest opening a new support ticket. We also highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins.

If further assistance is needed, please contact our support team.

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 1 reply, has 2 voices.

Last updated by Bobby 1 year ago.

Assisted by: Bobby.

Author Posts
April 23, 2024 at 7:12 pm #15557854

ricardod-3

Hello,

I am trying to translate a shortcode because a plugin i use ARPrice is not supporting WPML. I followed https://wpml.org/documentation/support/language-configuration-files/translate-custom-shortcodes-with-wpml/ But without any succes.

What i did is added this custom XML code:

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

and i have added this to the functions.php file in my theme:

add_filter( 'wpml_tm_job_field_is_translatable', '__return_true' );

After that i search for the ID in the advanced translator but i cannot find anything.

The shortcode i use is: [ARPrice id=100]

For clarification, i am using ACF, the fieldgroup is set to expert and the Translation preferences is set to translate

Hope you can help

SS1.png
April 23, 2024 at 8:01 pm #15558168

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi there,

Custom work is out of scope for support within this forum. However, I'd be happy to point you in the right direction.

For further assistance, please consider contacting one of our third-party contractors who specialize in custom projects with WPML.

You can find a list of these experts here:
https://wpml.org/contractors/

I did a quick test in a sandbox environment using your shortcode and adding the XML configuration and it looks like it is working OK.

These are my steps:

1. Create a page and add the shortcode

2. Go to WPML->Settings->Custom XML Configuration and add the following

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

3. Add

add_filter( 'wpml_tm_job_field_is_translatable', '__return_true' );

to the theme's functions.php

4. Now go back to the page and make a small edit and update (this is important)

5. Add or edit the translation and search for '100'

You are welcome to review the sandbox here:

hidden link

Screen Shot 2024-04-23 at 12.56.09 PM.png