• Hi,

    after the problems with Visual Composer have been solved, is there something planned for Fusion Page Builder (used e.g. in the widespread commercial Theme “Avada”) as well? Falling back to the native editor and using shortcodes manually is not a viable solution for my purpose. I can offer a full test setup for development, so you don’t have to purchase anything. I can assist in the process as well, just let me know how I can help.

    I am using WP 4.2.1 with latest Avada (3.8.3) and the bundled fusion core plugin (1.7.2). When I create a new page or post and use the fusion builder to create the content visually, the page/post is saved as completely empty. When I disable the fusion builder (Avada Theme Option), everything, including language-switching, works as expected. But I need the visual editor, teaching all authors how to use the long list of shortcodes isn’t a viable solution right now.

    I’m ready to help solving this any way I can.

    Best regards

    https://www.ads-software.com/plugins/qtranslate-x/

Viewing 10 replies - 16 through 25 (of 25 total)
  • @heero & @codingdude.

    I’m a total newb and I tried using the code from coding dude to make a plugin, along with the instructions found here: https://www.itworld.com/article/2833157/open-source-tools/how-to-build-a-wordpress-plugin-for-beginners.html

    The code I used was this:

    \<\?php
    /*
    Plugin Name: Fusion Page Builder & qTranslate-x
    Description: To make both plugins work together.
    Author: Coding Dude
    Author URI: https://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' );

    However, it made some text from the plugin appear in the admin area. I promptly deleted it. Any ideas on what went wrong?

    hi webmasterSK,

    your code starts with \<\?php

    is that a typo? the backslashes don’t belong there, it should be simply

    <?php

    @codingdud,

    Thanks for looking at that for me. Much appreciated.

    Yes, that was in the code. I am totally new to this, so sorry for my rookie mistake. I copied it from the tutorial — it had the same mistake there.

    I changed the code now, and I am still getting this text at the top of the admin area:

    e_js(){ echo ""; } //add some inline JS in the admin area add_action( 'admin_print_scripts', 'bapro_admin_inline_js' );

    There might be some more text there too — part of it is getting cut off. When I inspect the text in the admin area I get this:

    <body class="wp-admin wp-core-ui js plugins-php auto-fold admin-bar branch-4-2 version-4-2-2 admin-color-fresh locale-en-us customize-support svg">
    function bapro_admin_inline_js(){ echo "

    My new code for the plugin is this:

    <?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: https://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' );

    I noticed in Komodo edit that the last line “//add some inline JS in the admin area” isn’t greyed out like comments should be. I assume that this is a syntax error somewhere, but I don’t know any php or javascript, so I am just making stabs in the dark.

    I moved the ending php tag ?> to the bottom of the doc, rather than under the comments about who made the plugin, etc. This seemed to help, as the comment is greyed out now.

    However, when I tried to active the plugin, I got this error: Parse error: syntax error, unexpected ‘var’ (T_VAR) on line 18.

    Line 18 according to Komodo edit is this: var _ypos = window.scrollY;

    I tried looking at this article concerning javascript in wordpress plugins, but it is all going over my head.

    Here is my new code for reference:

    <?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: https://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,

    sooooooorrryyy, my mistake. There was a missing ” in the code just before the function(), add it there:

    jQuery(\"input[name='save']\").hover(".
    " function(){

    I also made the change on https://www.coding-dude.com/wp/web-design/wordpress/solved-problems-with-qtranslate-and-fusion-page-builder-avada-theme/

    @codingdude Thanks! Thanks for helping a non-programer out. ?? I only play with code enough to get myself into some trouble. ?? @heero I can confirm that this is plugin now working on my site. I tested it with publish too – it seems to catch the issue in that instance as well.

    Right now my site is in dev mode so I am the only one working on it, but when we make it live this plugin will be a lifesaver. Thanks again codingdude!

    glad to be of help!

    I’m totally new to this. how do we make a plugin?

    Can someone tell me where I need to put the php code?

    thank you,

    Plugin Author Gunu

    (@grafcom)

    @multimobile

    I’m totally new to this. how do we make a plugin?

    look here https://codex.www.ads-software.com/Writing_a_Plugin

    @multimobile

    You don’t actually have to write a whole plugin. for a quick and dirty solution you can go to your admin console Appearance > Editor select your theme, find the functions.php of the theme on the right hand side and click on it.

    Then place the code at the end of this file and save.

    Please be aware that you will potentially mess up your site if something goes wrong so make a backup of the functions.php file before doing the changes.

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘qTranslate-X and Fusion Page Builder’ is closed to new replies.