Monthly Archives: June 2012

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:
}

WordPress Weird Character issue on exported database

Hi All,
Yesterday after I uploaded one of the websites from local to staging I realized that most of the content was in some weird characters.

Ex: ’, â„¢, œ

The content was full of these.

My normal release process is,
1- do the changes on localhost
2- upload to staging server and send to client for approval
3- upon approval upload the changes to live website

so basically what I do is upload the wp-content files from file-zilla and then export the local database to a external sql file and change all the links to staging/live versions and then run the script on staging or live server.

So these weird characters was coming in the exported file of the localhost. not in the website on local host it self.

After some researching I found that although my wordpress database was in utf-8 encoding the editor I use to change the links notepad++ is in ANSI encoding.

Solution – change encoding to utf-8 on notepad++

Change encoding in notepad ++

Problem solved. 🙂