Last Updated: February 25, 2016
·
836
· pipejesus

Wordpress - WYSIJA + Qtranslate simple dirty snippet that works

Hi guys, i used this solution in my last project. I just needed to get qtranslated post title and content to be inserted in e-mail template during drag & drop and here it is.

  1. Open

    /plugins/wysija-newsletters/controllers/ajax/campaigns.php

Around line 353 you will see:

$res['posts']=$model->query('get_res',$querystr);

after this line add:

foreach ($res['posts'] as &$translate_post) {

$translate_post{'post_title'} = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($translate_post{'post_title'});

$translate_post{'post_content'} = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($translate_post{'post_content'});

}

and you should get the contents translated according to the language currently used in the admin panel.