Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Somewhere in my code I need to know what is the current language and display a certain custom field or another one based on this knowledge.

How can I know this information ?

share|improve this question
1  
wpml.org/documentation –  John P Bloch Jun 30 '11 at 20:54
    
Yes it was there : wpml.org/documentation/support/wpml-coding-api –  Mike Jun 30 '11 at 22:33

1 Answer 1

up vote 3 down vote accepted

WPML defines constants that you can use go get the current language:

  • ICL_LANGUAGE_CODE - current language code (eg: en,fr,sp).
  • ICL_LANGUAGE_NAME_EN - Name of the current language in English (eg: English, French. Spanish).
  • ICL_LANGUAGE_NAME - Name of current language, in the current language (eg: English, Français, Español).
share|improve this answer
    
Thank you Bainternet –  Mike Jul 2 '11 at 10:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.