Wordpress and qTranslate - getting current language in functions.php -


i using qtranslate plugin wordpress site , have detect active language in themes functions.php file. detection function qtrans_getlanguage() working, however, shows default language (en) active, though have switched in page itself. how can detect language in function file?

this worked me:

if (qtrans_getlanguage() == 'en') {   // english   print "hello world!";  } elseif (qtrans_getlanguage() == 'es') {   // spanish   print "hola mundo!";  } 

notice change in qtranslate x (the new version):

if (qtranxf_getlanguage() == 'en') {   // english   print "hello world!";  } elseif (qtranxf_getlanguage() == 'es') {   // spanish   print "hola mundo!"; } 

there compatibility functions in plugin options according this

notice apply code need php knowledge, , works translate exact parts of wordpress theme


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -