Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • @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!

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

    @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' );

    @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?

    Thread Starter webmasterSK

    (@webmastersk)

    No, there isn’t a free version. ?? I messed with the CSS in both the widget and my child theme, and now things are displaying correctly when I use the widget from qTranslate-x rather than the menu item.

    Thanks for all your help, and for pointing me to the beta version – that fixed the main issue with the submenu.

    Thread Starter webmasterSK

    (@webmastersk)

    I created a new “UberMenu Configiration” that applies only to the top navigation – it seemed to help. Now the widget area is working and things are displaying in a somewhat normal way….except now my main menu is being covered by the top orange bar. Continuing to mess with those settings to see if I can fix how things are being displayed.

    Thread Starter webmasterSK

    (@webmastersk)

    1) Settings: Screenshot here.

    2) Default Language: English

    3) Yes, I used Appearance – Menus – Language Switcher. However, I am now also trying to add it via an UberMenu Widget area.

    4) Yes, I am using the Avada theme, however I have the fusion builder disabled in the theme options as I know it conflicts with qTranslate. (I am aware of the known issue and have read up on it.) I disable qTranslate-x when I need to use the page builder, and once the site is live I will enable the setting in qTranslate that turns off the button switcher whenever I need to use the page builder to make edits.

    5) It works when I use a standard WP theme, although the languages are drop-down items. (I’m not sure if that is normal behavior or not.) The UberMenu Widget area remains broken.

    Thread Starter webmasterSK

    (@webmastersk)

    Wow! Thanks, the beta version fixes the dropdown conflict. Yay!

    I also realized that Ubermenu allows you to put widgets in the menu, so I tried using that to place the language widget there, but it didn’t work. So neither the widget or the language selector menu display properly there…

    Thread Starter webmasterSK

    (@webmastersk)

    @gunu – thanks for looking into this.

    My theme only allows the option of navigation, social links, contact text, or leave empty in the section where I have the language selector. I have navigation enabled, and then using the language selector menu.

    I might be able to edit some of the CSS to make the flags be in the right place…but I’m a newbie so I’m just fiddling around.

    The dropdown being on the homepage on the other-hand – I have no idea where to even begin on that one.

Viewing 9 replies - 1 through 9 (of 9 total)