bluedrag
Member
Posted 10 months ago #
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!
Try this it with: if(qtrans_getLanguage()=='en') { ... }
bluedrag
Member
Posted 10 months ago #
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="http://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="http://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.
janper
Member
Posted 3 months ago #
is it possible to set language similarly?
thanks!