This thread is resolved. Here is a description of the problem and solution.
Problem:
How to code PHP as per current language?
Solution:
You have to use "ICL_LANGUAGE_CODE" to get your current language.
Here is the sample code/structure
function my_custom_function() { if(ICL_LANGUAGE_CODE=='en'){ <!--- your code to english---> } elseif(ICL_LANGUAGE_CODE=='de'){ <!---your code to german---> } elseif(ICL_LANGUAGE_CODE=='fr'){ <!---your code to french--- Global site tag (gtag.js) - Google Analytics --> } elseif(ICL_LANGUAGE_CODE=='es'){ <!---your code to spanish---> } }
Modify your code according to this and you will get what you want.
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 2 replies, has 2 voices.
Last updated by grzegorzS-19 4 years, 3 months ago.
Assisted by: Riffaz.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.