WordPress qtranslate plugin detect language on theme files


How to detect the language on the theme files when your using qtranslate?

Well that is a good question. Why might we want to do that? well you can display diffrent contents to users based on their selected language, That’s why… 🙂

So how to do it,

if(qtrans_getLanguage()==’th’) {
// put your the content you want to display when thai language is selected ex:
} elseif(qtrans_getLanguage()==’en’) {
// put your the content you want to display when English language is selected ex:
}

Advertisements

2 thoughts on “WordPress qtranslate plugin detect language on theme files

  1. Sander

    Hi, I was looking for this solution..
    But where can i put this code? in which file should I insert it?
    Thanks is advance

    Reply
    1. surendias Post author

      Hi Sander, Thanks for your comment, You should use this code in the theme files. If your using a custom template file you should put this code there. Let me know if this is still not clear.

      Reply

Let me know what you think .. :)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s