Is there a way to make these two great plugins work together?
CONTEXTUAL RELATED POSTS + QTRANSLATE
Anyone succeeded at this?
Post titles do get translated, however the title of Contextual Realated Posts widget does not
Fers, am not familiar with QTranslate. Is it just a simple plugin that creates a translation of all text on your blog?
Is there something special that the plugin authors need to do for getting it compatible ?
What Qtranslate does is to store each post’s title and contents within wp’s database in multiple languages, but under the same post id. Each text block is preceeded by a shortcode that “marks” the start and end of the translated string/text, then at the time of displaying the post in, let’s say English, it filters the content leaving just the desired language visible. And all this works perfect with CRP. CRP shows the post titles in the correct language in the widget.
It’s only the widget TITLE the one that does not play well and does not get translated (instead it shows the full multilanguage string along with qtranslate’s shortcodes). Weird!
Am going to take a wild guess here, but it could possibly be because qTranslate isn’t able to read the Title of the widget. Do you know if there is a specific piece of code / method that can be added to get qTranslate to detect this?
No idea honestly, I will investigate a bit so that maybe we can sort this out. But it’s got to be a trivial matter I hope 🙂
Sounds good. If you figure out what code changes / links which I can read to understand this, let me know. I’ll see what I can do.
Do other widgets from plugins work fine for translation?
Standard “Recent posts” plugin in twenty Ten gets its widgets title translated through qTranslate, for instance.
Maybe this helps?
Can you try editing contextual-related-posts.php after line 344
$title = apply_filters('widget_title', empty($instance['title']) ? strip_tags($crp_settings['title']) : $instance['title']);
if(function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) $title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($title);
Done. No effect unfortunately. Still getting
as the output.
By the way… Is it a “widget” properly speaking? Because CRP in fact inserts its output below the post content in my case. Not using it as a “widget” from the “widgets” menu in the WPtheme.
Update. As I said before, I am not using the widget mode, but instead the option that injects CRP at the end of post content, and in this scenario, the bug exists. However, just for testing I also added CRP as a widget from the widgets menu in WP, and in this case it works flawlessly. The title of the widget displays only the correct language.
Fers, was confused since you said Widget title in the earlier post. In this case, what you need to do is add the above code after line 79:
if (empty($limit)) $limit = stripslashes($crp_settings['limit']);
Hi Ajay, I’m REALLY sorry for the misleading info. 🙁
Look, the line of code you just told me to add after line 79 is already there (in line 79!).
Maybe you pasted line 79 itself in your last reply?
Ajay, disregard my last email please. The code you told me to insert is the one in the previous email, if(function_exists(‘qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage’)) ….
So, added it after line 79, and still the title of the lest’s call it “CRP Box” shows the multilingual string.
Fers that sounds great! Am assuming this fixes it well?
No, it did not. The trick was somewhere else.
At Line 98, I tried the following and yes, this cures the bug!
if(function_exists(‘qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage’)) $title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($crp_settings[‘title’]);
$output .= (stripslashes($title));
My question now is, do you plan to insert this in a future update? Otherwise each time your plugin has a new version, the problem would reappear.
- The topic ‘CRP & QTRANSLATE’ is closed to new replies.