Support » Plugin: Weaver Xtreme Theme Support » Defer Parsing Of Javascript

  • Okay, I have tried multiple plugins and adding suggested code to the functions.php file and I am unable to defer the parsing of javascript. Is this something that cannot be accomplished in this theme? Hoping someone can point me in the right direction to something that actually works.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • If I add the following to the bottom of the functions.php file my GTMetrix score goes from 79 to 88. However, that only lasts one test. Test it again and the score drops right back to 79.

    /**
    * Defer parsing of javascript.
    */
    if (!(is_admin() )) {
    function defer_parsing_of_js ( $url ) {
    if ( FALSE === strpos( $url, ‘.js’ ) ) return $url;
    if ( strpos( $url, ‘jquery.js’ ) ) return $url;
    // return “$url’ defer “;
    return “$url’ defer onload='”;
    }
    add_filter( ‘clean_url’, ‘defer_parsing_of_js’, 11, 1 );
    }

    scrambler

    (@scrambler)

    This forum is not monitored, so you need to post your questions on the weaver forum
    https://forum.weavertheme.com/

    But Xtreme rune several scripts at critical times during load (before during and after), so you should not interfere with the script execution order.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Defer Parsing Of Javascript’ is closed to new replies.