Support » Fixing WordPress » Modifying qTranslate

  • Resolved bluedrag


    I’m trying to have my own php code run if a certain language is active in the qTranslate plug in but I can’t seem to find the right variables to use. heres a little pseudo-code of what I’m trying to do.

    if(languageCode == en) {
    //run my own code
    if(languageCode == fr) {
    //run different code

    Hopefully someone can help me with this, thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator keesiemeijer



    Try this it with: if(qtrans_getLanguage()=='en') { ... }



    Thanks! I got it working!

    A little note for people trying to get qTranslate to only display the none active language, this is how you do it.

    if(qtrans_getLanguage() == 'en'){
    	echo '<li class="lang-fr active"><a href="" hreflang="fr" title="Fran├žais"><span>Fran├žais</span></a></li>';
    if(qtrans_getLanguage() == 'fr'){
    	echo '<li class="lang-en active"><a href="" hreflang="en" title="English"><span>English</span></a></li>';

    This code will display an anchor to change to active language to french when english is active and english when french is the active language.

    is it possible to set language similarly?


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Modifying qTranslate’ is closed to new replies.