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:
<?php /* Plugin Name: Fusion Page Builder & qTranslate-X Description: To make both plugins work together by restoring page to default editor before save. Author: Coding Dude Author URI: //www.coding-dude.com/wp/web-design/wordpress/solved-problems-with-qtranslate-and-fusion-page-builder-avada-theme/ */ function bapro_admin_inline_js(){ echo "<script type='text/javascript'>\n"; echo "function fixQTranslate(){ //when user goes with the mouse over the Update button jQuery(\"input[name='save']\").hover(". "function(){ //if the fusion page builder is active if(fusionBuilderState == 'active'){ var _ypos = window.scrollY; //click to switch to the Default editor jQuery( '#fusion-pb-switch-button' ).click(); //scroll to the same position as before the Default editor was active window.scrollTo(0,_ypos); }; }); }; //after the editor page is fully loaded add the fix document.addEventListener(\"DOMContentLoaded\", fixQTranslate);"; echo "\n</script>"; } //add some inline JS in the admin area add_action( 'admin_print_scripts', 'bapro_admin_inline_js' ); ?>
Hi,
how and where do I insert this plugin. I never created a pluggin.
Can you please help.
thank you!
You can insert the code in your theme’s functions.php file, though I would advise you to make a backup if you don’t know your way around WordPress’s code
Hi, there
I’ve applied your plugin, but I don’t understand why when I switched between two languages text I typed hasn’t changed. For example: I write “sth” in my language and then switch to another language and type “sth2” when I switch again to the first language and “sth” is dissapeared and “sth2” is for both the same. Could you help me with this?
Hi, it broke my Avada installation. After restored the old function.php and still not working I’m restoring also wp content .
No idea why.
Hi Lou,
I can’t imagine why it could break your Avada installation, and for sure there is no way that the changes persist after you remove the plugin.
Hi! I’m using your plugin. I’ve the same problem of Endri when I switch between two languages. I wrote a text in my language, and I switched on the language 2 to translate it. I switched back on my language I have seen the text on language 2. My language text had been cancelled
What can I do?
Many thanks.
Hi Marcella,
my plugin in is meant as a temporary fix, so there might be quirks to it. Did you try saving before switching the language?
Thank you so much for this solution, really made my day!
Glad to help!
Hi and thanks for this solution! It has worked really well on one of my sites until recently when it seems like the plugin doesn’t do its’ thing anymore… The former issue is back, with content being duplicated. Maybe there’s been an update in qTranslate or Fusion Builder that made this stop working?
Hi,
it’s been a while since I’ve looked at this. I will try to update and see what happens
I also hope to update the plug-ins.
Thank you so much..
Hello! This plugins is the perfect solution! But there are a issue when you need to switch between languages in a page/post with qtranslate buttons, the fusion builder content don’t change.
But if you click in “Use default Builder” and come back again to Fusion Builder clicking in “Use Fusion Builder”, then the content change.
This is dangerous because you could miss information, so there are any fix to that?
Thank you!
Hi, do you still work with Avada and qTranslate X? It used to work just fine until Avada 5. Now, however, when I use the fusion builder, I can’t find any fields for the two added languages. So what I do is I design the page with the fusion builder and then switch to the default editor where I can switch between languages. I copy the shortcodes generated by the fusion builder and do the translation then. That kind of sucks though and I would like to know if you know how to get an option for content in different languages. When I switch languages with the tabs, my original German version is all I get.