This thread is resolved. Here is a description of the problem and solution.
Problem:
Want to include a javascript snippet on a specific language
Solution:
The task mentioned should be achievable with a code implementation. Before adding the code, you'll need to determine the current language of your website. Fortunately, WPML provides a hook for this purpose: https://wpml.org/wpml-hook/wpml_current_language/.
Here's an example of how you can use this hook to apply code for a certain language:
// Get the current language $current_language = apply_filters( 'wpml_current_language', NULL ); // Check if the current language is the desired one if ( $current_language === 'your_desired_language_code' ) { // Add your code here to be applied for the specific language ?> <script> // Your script code goes here </script> <?php }
Please replace `'your_desired_language_code'` with the language code you want to target. This way, the code will only be executed when the current language matches the specified language code.
Relevant Documentation:
https://wpml.org/contractors/
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.
Our next available supporter will start replying to tickets in about 2.90 hours from now. Thank you for your understanding.
This topic contains 2 replies, has 2 voices.
Last updated by pernilleL 9 months, 4 weeks ago.
Assisted by: Shekhar Bhandari.