Working on a huge project for RiskRhino I’m developing their websites using the Avada theme for WordPress. Since RiskRhino is a company based in the Netherlands it was necessary to add a Dutch version to the site. Implementing this turned out to be quite a challenge as the free translation plugins available out there is quite limited. Eventually I chose qTranslate X, but to my surprise I found out that qTranslate and fusion page builder (Avada theme) do not go well together. After some head scratching and other web development and programming techniques I’ve figured out how to go around this problem.
qTranslate and Fusion Page Builder – the problem
Apparently, when using the Fusion Page Builder that comes with Avada, when you save a post or page the qTranslate X plugin gets confused and does not know how to properly set the language markers that it uses (ex. [:en] for English, [:nl] for Dutch). The plugin assumes that the Default post/page editor is in use and it only knows how to work with that.
So, when saving a post or page from the Fusion Page Builder the content for both languages gets stored every time. Everytime you save the content gets duplicated.
The work around: If before saving a post or page you switch to the Default editor and save, then all goes well. The problem I had was that merely informing the editors about this workaround is not enough, and if one of them forgets about switching to the Default editor then your content will get messed up. So, I had to find a way to enforce this way of working.
qTranslate and Fusion Page Builder – the solution
My solution was to create a plugin that automatically switches to the Default editor right before saving. This way you make sure that the translations are properly saved. The code for the plugin is short and straight to the point: