• Resolved neotrope

    (@neotrope)


    Hi, folks
    thanks for all the updates to plugin; and thanks for helping me with the two prior ‘generations’ of the plugin to ‘unhook’ the javascript and CSS loading on page.

    In our case, we have custom CSS button with link to download PDF of each story on our news portal; however latest version you again changed the javascript file sources, so they are again loading in our header/footer when we don’t need them loading for every page, as we don’t use any of the JS for your built-in buttons on page.

    An option to ‘not load css/js assets on page’ would be most welcome here.

    We are currently doing this, by way of example, with your past assistance:

    function my_theme_remove_assets_header() {
      wp_dequeue_style('pdfprnt_stylesheet');
    }
    add_action( 'wp_print_styles', 'my_theme_remove_assets_header' );
    function dequeue_my_css() {
      wp_dequeue_style('pdfprnt_frontend');
      wp_deregister_style('pdfprnt_frontend');
    }
    add_action('wp_enqueue_scripts','dequeue_my_css',100);

    With latest version for PHP7; and updated PDF library; need a way to disable the javascript the plugin now loads in header/footer.

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter neotrope

    (@neotrope)

    To clarify, it looks like you added an option to print via JavaScript vs using server resources. In our case we have dedicated server and don’t want to have additional .js running/loaded on pages.

    Our site is highly optimized for mobile with 100% SEO and PageSpeed Score with Google; and the new .js loading every page effectively *doubles* the size of each page which is not great for us.

    I will try to make a function to unhook .js, but would be better to have option to disable the option entirely — unless I totally missed that. 🙂

    Thread Starter neotrope

    (@neotrope)

    Here is what I’m trying to do; can you please provide the correct ‘IDs’ for the java assets so I can unhook them for our purposes? Thanks 🙂

    function pdfCleanr_disable_scripts_styles() {
    	
    wp_dequeue_script('front-script.js');
    wp_dequeue_script('html2canvas.js');
    wp_dequeue_script('jspdf.js');
    }
    add_action('wp_enqueue_scripts', 'pdfCleanr_disable_scripts_styles', 100);
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Unhook javascript loading in posts’ is closed to new replies.