Skip Navigation

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

Last updated by Long Nguyen 1 year, 10 months ago.

Assisted by: Long Nguyen.

Author Posts
August 6, 2023 at 4:14 pm #14160259

guillermoC-11

I have a shortcode with the following format:

[whmcs pid="123" bc="3y" currency=1 promo=1] and I want to be able to change the values in the advanced editor; the only value I care about is currency

So I Added:
<wpml-config>
<shortcodes>
<shortcode>
<tag label="whmcs">whmcs</tag>
<attributes>
<attribute label="pid">pid</attribute>
<attribute label="bc">bc</attribute>
<attribute label="currency">currency</attribute>
<attribute label="promo">promo</attribute>
</attributes>
</shortcode>
</shortcodes>
</wpml-config>

To the custom XML config, but is not working; Advance editor shows wpcodeself instead of the shortcode⁣⁣⁣⁣⁣.

I also tried to edit the shortcode on the translated page, and it works for a while, but if I update the translation with the advanced editor, the translated shortcode is overwriteen

How can I make a shortcode editable in the advanced editor? And what am I doing wrong?

Note: I'm using Elementor Pro, and the shortcodes are set inside the pricing text file from Elementor Price Tables

Thanks

Advanced-Translation-Editor-WPML2.png
Advanced-Translation-Editor-WPML1.png
August 8, 2023 at 4:07 am #14166567

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

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

Hi Guillermo,

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

By default, the numeric value is not displayed in the Advanced Translation Editor (ATE). You can:

1. Go to WPML > String Translation > Search for the value and translate it there.

2. Or add the code below to the file functions.php in the theme/child theme folder
❌ IMPORTANT: Please backup your database and website before proceeding ❌

/**
 * Allow translating numbers
 * @see https://wpml.org/forums/topic/wpbakery-post-grid-element-exclude-from-filter-list-category-reappears
 */
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 );

and update the page > Update the translation. In ATE, you can search for the numeric value and translate it. Please follow the documentation https://wpml.org/faq/how-to-translate-urls-shortcodes-and-html-attributes-using-the-advanced-translation-editor/

Look forward to your reply.
Thanks

August 8, 2023 at 2:45 pm #14170203

guillermoC-11

Thank You, it works; now I can edit the values in ATE, but... because some values can be repeated like [whmcs pid="123" bc="3y" currency=1 promo=1]
promo and currency both are = 1, is prone to errors, and mi translator is not tech savvy

Is it possible to show the full shortcode in ATE or at least promo=X currency=X?

Thanks again

August 9, 2023 at 1:42 am #14172673

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

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

Hi,

I'm afraid that it isn't possible, only the attribute value will be translated. You can explain more about the attribute in the label content, for example:

<attribute label="promo value here">promo</attribute>

Please check this screenshot hidden link

I hope I was helpful. Don't hesitate to ask if you find any problem along the way, I'll gladly help you.