This is a PRIVATE forum for verified users only, to view all replies/answers, you must be logged in!
Tagged: Speed
- AuthorPosts
- January 22, 2015 at 1:54 am #6327
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 );
- January 22, 2015 at 4:36 pm #6345
Hey there, You must be logged in to view this reply!
- January 23, 2015 at 12:23 am #6372
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.
- January 25, 2015 at 5:04 pm #6414
Hey there, You must be logged in to view this reply!
- January 25, 2015 at 9:31 pm #6430
Alright thank you 🙂 btw did I placed the code correct in custom-functions.php?
- January 27, 2015 at 7:45 am #6450
Hey there, You must be logged in to view this reply!
- AuthorPosts
- 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!