30th Jun2014
Author: Gyro

Using qTranslate with WordPress 3.9++

I've been a long time fan of Qian Qin's qTranslate plugin, which allows you to translate just about everything you need to have a multilinugal website running on WordPress.

Unfortunately, he seems to have fallen off the face of the earth since WordPress Version 3.9 came out, so installing the plugin will result in its automatic deactivation, as the only available qTranslate version has not been officially tested with any WordPress version newer than WP 3.8.1 :(

I've been waiting for an update for months now, and I have come to the realization that I may have to wait a lot longer. So, I decided to see what I can do with this plugin to make it work again. Turns out, there are two simple file modifications needed in order to make qTranslate work with WordPress 3.9.1, which is the newest WP version that is available while I am writing this post.

If a new WP version is released, come back here to check if this fix/hack still works, BEFORE you update your WP installation.

Should there be a newer version available than WordPress Version 3.9.1, please write a comment. I will reply with a status report asap!

qTranslate WordPress 3.9 Fix

Short Question: So, what is there to do?

Short Answer: You have to modify two files in the /qtranslate/ plugin folder (via ftp).

1. Modify qtranslate.php

change this:

define('QT_SUPPORTED_WP_VERSION', '3.8.1');

to this:
define('QT_SUPPORTED_WP_VERSION', '3.9.1');
which allows activating qTranslate up to WordPress version 3.9.1.

You could also do this:

define('QT_SUPPORTED_WP_VERSION', $wp_version);
which allows activating qTranslate on EVERY new WordPress version. Warning: qTranslate may be incompatible with future WordPress versions and break your website! I highly recommend the first option.

2. Modify qtranslate_core.php

change this:

function qtrans_dateFromPostForCurrentLanguage($old_date, $format ='', $before = '', $after = '') {
global $post;
return qtrans_strftime(qtrans_convertDateFormat($format), mysql2date('U',$post->post_date), $old_date, $before, $after);
}

to this:
function qtrans_dateFromPostForCurrentLanguage($old_date, $format ='') {
global $post;
return qtrans_strftime(qtrans_convertDateFormat($format), mysql2date('U',$post->post_date), $old_date);
}

And that's already all there is to it! :)

Enjoy!

p.s. You may want to add this to your functions.php, it will increase the width of menu items in the admin… these tiny input fields drove me insane! :crazy:

add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
echo '<style>
.menu-item-bar .menu-item-handle {
width: 582px;
}
.description-thin {
width: 550px;
}
.menu-item-settings {
width: 602px;
</style>';
}

Sources:
http://wordpress.org/support/topic/the-qtranslate-editor-has-disabled-itself-because-it-hasnt-been-tested-with-you
http://alexander.kirk.at/2014/04/17/fix-qtranslate-with-wordpress-3-9/
http://css-tricks.com/snippets/wordpress/apply-custom-css-to-admin-area/

1585

Keep Me Going
Your Name / Website:
Did you like my post? Buy me a Bitcoffee! 14JX52Li7zTKbyQv2omw4tvu6Bi1KzfHNW



One Response to “Using qTranslate with WordPress 3.9++”

Leave a Reply

Your email address will not be published. Required fields are marked *

What is 14 + 3 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)