How to improve speed.

This topic is: Resolved

This is a PRIVATE forum for verified users only, to view the replies/answers, you must be logged in!

Tagged: 

This topic contains 5 replies, has 3 voices, and was last updated by  Jacob 1 year, 10 months ago.

  • Author
    Posts
  • #6327

    Erick
    Member
    Post count: 1018

    I was hoping if you guys knew a way to improve “Remove query strings from static resources”

    I was looking around and I got this two codes to be added to the functions.php but I really dont know a lot about the .php

    function _remove_script_version( $src ){
    	$parts = explode( '?', $src );
    	return $parts[0];
    }
    add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
    add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
  • #6345

    Max
    Staff
    Post count: 3150

    Hey there, You must be logged in to view this reply!

    Login | Register | Forgot Password?

  • #6372

    Erick
    Member
    Post count: 1018

    Alright well I added it and it looks something like this :

    <?php
    
    /**********************************************************************************************************
     *        __   _______    _    _   _ _____ _   _ _____ __  __ _____ ____         ____ ___  __  __
     *        \ \ / / ____|  / \  | | | |_   _| | | | ____|  \/  | ____/ ___|       / ___/ _ \|  \/  |
     *         \ V /|  _|   / _ \ | |_| | | | | |_| |  _| | |\/| |  _| \___ \      | |  | | | | |\/| |
     *          | | | |___ / ___ \|  _  | | | |  _  | |___| |  | | |___ ___) |  _  | |__| |_| | |  | |
     *          |_| |_____/_/   \_\_| |_| |_| |_| |_|_____|_|  |_|_____|____/  (_)  \____\___/|_|  |_|
     *
     *				  		Premium WordPress Themes by YeahThemes.com - http://Yeahthemes.com
     *												Copyright (c) YeahThemes
     *											http://themeforest.net/user/Manh
     *
     **********************************************************************************************************/
    
    function _remove_script_version( $src ){
    	$parts = explode( '?', $src );
    	return $parts[0];
    }
    add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
    add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
    
    

    I hope that is the way its supposed to be.

    Also I wanted to defer the java using this snippet

    <script type="text/javascript">
    function downloadJSAtOnload() {
    var element = document.createElement("script");
    element.src = "defer.js";
    document.body.appendChild(element);
    }
    if (window.addEventListener)
    window.addEventListener("load", downloadJSAtOnload, false);
    else if (window.attachEvent)
    window.attachEvent("onload", downloadJSAtOnload);
    else window.onload = downloadJSAtOnload;
    </script>

    But I am not sure where to locate my html file to put it there.

  • #6414

    Max
    Staff
    Post count: 3150

    Hey there, You must be logged in to view this reply!

    Login | Register | Forgot Password?

  • #6430

    Erick
    Member
    Post count: 1018

    Alright thank you 🙂 btw did I placed the code correct in custom-functions.php?

  • #6450

    Jacob
    Staff
    Post count: 2312

    Hey there, You must be logged in to view this reply!

    Login | Register | Forgot Password?

You must be logged in to reply to this topic.

This is a PRIVATE forum for verified users only, to view the replies/answers, you must be logged in!