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

Last updated by dinoT-3 2 months, 2 weeks ago.

Assigned support staff: Bruno.

Author Posts
July 31, 2019 at 10:14 am #4313601

dinoT-3

Tell us what you are trying to do?

I have added a custom select field in checkout. I have translated all the field, so it can show in different languages. I want to show the output value in the different languages, the same as strings translate. (attached is the code)

Is there any documentation that you are following?

https://wpml.org/forums/topic/icl_object_idpost-id-product-true-wpml_default_language/
I read this article which is opposite to my situation. He wants to use the same English no matter the site changes language.

July 31, 2019 at 5:34 pm #4317055

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Thank you for contacting us. In this case, I think you can switch the language to English and then return to the current language to display the desired English content. For example:

// get the global object
global $sitepress;

// use the switch_lang method before the loop
$sitepress->switch_lang( 'en' );

// loop
$a = new WP_Query( ... );

// back to the current language
$sitepress->switch_lang( ICL_LANGUAGE_CODE );

Please note that unfortunately, custom coding is beyond the scope of our support.

We have a list of WPML and WooCommerce Multilingual hooks that can help you develop such feature, which can be seen in the links below:

- https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference
- https://wpml.org/documentation/related-projects/woocommerce-multilingual/wcml-hooks-reference/

If you prefer, you can contact one of our certified partners who can develop small to large features for your site: http://wpml.org/documentation/support/wpml-contractors/

Please, let me know if I can help with any other questions you may have about it. I'll be happy to help.

Thank you.

August 2, 2019 at 2:24 am #4325921

dinoT-3

Thank you!