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.

This topic contains 4 replies, has 2 voices.

Last updated by jasonS-17 5 months, 2 weeks ago.

Assigned support staff: Riffaz.

Author Posts
May 7, 2019 at 4:30 am #3753797

jasonS-17

Hi,

I am familiar with wpml-config.xml in adding page builder widgets to WPML. I have got most to work but have one that has an interesting structure.

Is it possible to cater to the following shortcode in the xml, highlighting the nested attributes box_heading and box_text.

[icon_box options='{"id":569,"parent":567,"original":{"box_heading":"VFJBTlNMQVRFIE1FIDI=","box_text":"VHJhbnNsYWF0ZSBtZSBhc3dlbGw="},"activeselector":false}'][/oxy_icon_box]

Thanks,
Jason

May 7, 2019 at 7:31 am #3754769

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi,

Thank you for contacting WPML support.

Please refer : https://wpml.org/documentation/support/translating-urlencoded-shortcodes/

Let me know how it goes.

Regards,
Riffaz.

May 8, 2019 at 12:06 am #3762695

jasonS-17

Hi Riffaz,

I tried following these steps... main concern was that the example I have as Nested arrays in its Json structure and unlike example in the linked post, there are standard attributes prior to the array.

I have followed the instructions using box_heading and box_text as the targets fields.

if ( in_array( $key, array( 'box_heading', 'box_text' ) ) )

Do I need to specify the path? i.e - options.original.box_heading?

attribute1='123456',
options='{
"id":569,
"parent":567,
"selector":"_icon_box-569-8",
"original":{
"box_heading":"VFJBTlNMQVRFIE1FIDI=",
"box_text":"VHJhbnNsYWF0ZSBtZSBhc3dlbGw=",
"padding-top":"30"
},
"activeselector":false
}'

What has happened though, is the contents of this shortcode (which is itself another shortcode now appears... but I dont want to translate this. Only the 2 Attributes. Is it possible to ignore the contents of the shortcode from translation while only grabbing the attrubutes mentioned above?

Thanks ,
Jason

May 8, 2019 at 11:29 am #3765983

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi,

its really a matter of knowing how to code

first of all, we need to look for 'original'

if ( in_array( $key, array( 'original' ) ) ) {

New Messages
then add box_heading and box_text to the $string array

$string[ $key . '_box_heading' ] = array( 'value' => base64_decode($value['box_heading']), 'translate' => true );
$string[ $key . '_box_text' ] = array( 'value' => base64_decode($value['box_text']), 'translate' => true );

and finally put it all together again in wpml_pb_shortcode_encode_urlencoded_json()
its not very straightforward, if you are not fluent with PHP you can consider: https://wpml.org/contractors/
It is a custom work.

Alternatively, if you can get us in contact with the author we can help the author make his page builder compatible in the go-global program: https://wpml.org/documentation/theme-compatibility/go-global-program/

Regards,

May 9, 2019 at 6:10 am #3773231

jasonS-17

Ok, I tried the above but it targets an array variable, and my example is an array in an array variable.
[shortcode options{..,..,original{..,box_heading,box_text,..},},

I understand basic php but this is over my head. Also found the documentation vauge on the details in that the code examples dont relate directly to the example shortcode provided... so I couldn't connect the shortcode variable to the code.

I'll re-create the pagebuilder asset using div's/textboxes which I know get picked up by WPML as a work around.