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
Post a Comment