How to improve speed.

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

Status: resolved

Tagged: 

  • This topic has 5 replies, 3 voices, and was last updated 5 y, 10 mo by  Jacob.
Viewing 5 reply threads
  • Author
    Posts
    • #6327

      Erick
      Member

      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

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

      Login | Register | Forgot Password?

    • #6372

      Erick
      Member

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

      <?php
      
      /**********************************************************************************************************
       *        __   _______    _    _   _ _____ _   _ _____ __  __ _____ ____         ____ ___  __  __
       *        \ \ / / ____|  / \  | | | |_   _| | | | ____|  \/  | ____/ ___|       / ___/ _ \|  \/  |
       *         \ V /|  _|   / _ \ | |_| | | | | |_| |  _| | |\/| |  _| \___ \      | |  | | | | |\/| |
       *          | | | |___ / ___ \|  _  | | | |  _  | |___| |  | | |___ ___) |  _  | |__| |_| | |  | |
       *          |_| |_____/_/   \_\_| |_| |_| |_| |_|_____|_|  |_|_____|____/  (_)  \____\___/|_|  |_|
       *
       *				  		Premium WordPress Themes by YeahThemes.com - http://wpthms.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

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

      Login | Register | Forgot Password?

    • #6430

      Erick
      Member

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

    • #6450

      Jacob
      Staff

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

      Login | Register | Forgot Password?

Viewing 5 reply threads
  • You must be logged in to reply to this topic.

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

© Copyright 2020 by wpthms.com. All Rights Reserved.