• Resolved johnwp413

    (@johnwp413)


    I need to add a simple script to reverse the action of a plugin only on one or a few pages (it is active site wide). The plugin author recommends modifying the footer.php, but I would prefer not to do this. Using your plugin, I am able to inject this script intended to “hide” the plugin. But it does not load last, immediately before </body>. In fact, a few other theme scripts run (Avada theme) and then the plugin script runs. So it is literally the last thing loaded before the </body>. And the plugin remains active as it is the last script run.

    The script is:
    jQuery(document).ready(function($) {jQuery(“#sss-sidebar-source-div-1”).smartTabDrawer(“hide”);});

    Is there a way force it to a lower priority or a way to force it to load last? The page is here: https://www.rosssolargroup.com/friends/ (NOTE: I have deliberately used bad code to cause the plugin to “break” on the page. Same result as effectively hiding it.)
    Thanks! John

Viewing 1 replies (of 1 total)
  • Plugin Author WraithKenny

    (@wraithkenny)

    You can use a setTimeout() call: jQuery(function($){ setTimeout(function(){ $("#sss-sidebar-source-div-1").smartTabDrawer("hide"); }, 300); });, which might be the best way, since Avada may be adding scripts dynamically, instead of via wp_footer for all I know. My plugin is already adding the footer scripts at priority 11 (which should run after scripts added at the default priority).

Viewing 1 replies (of 1 total)
  • The topic ‘Need to add script immediately before’ is closed to new replies.