• Resolved bluedrag

    (@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

    (@keesiemeijer)

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

    Thread Starter bluedrag

    (@bluedrag)

    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.

    <?php  
    
    if(qtrans_getLanguage() == 'en'){
    	echo '<li class="lang-fr active"><a href="https://konggraphics.com/wordpress/?lang=fr" hreflang="fr" title="Fran?ais"><span>Fran?ais</span></a></li>';
    }
    
    if(qtrans_getLanguage() == 'fr'){
    	echo '<li class="lang-en active"><a href="https://konggraphics.com/wordpress/" 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?

    thanks!

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