How to register a global hotkey for your application in C#

How to register a global hotkey for your application in C#

Register a hotkey for your application that can be triggered even if your form is minimized and does not have focus. More »

Visual Studio 2013

Visual Studio 2013

Visual Studio 2013 is now available. Make sure to upgrade to the latest version of Visual Studio. More »

How to download a file in C# (progressbar and download speed)

How to download a file in C# (progressbar and download speed)

Learn how to download files in C# while displaying the percentage and the download speed. More »

UDP hole punching implementation in C#

UDP hole punching implementation in C#

Learn how to implement UDP hole punching so you can make your clients life a lot easier by not forcing them to open ports on their end. More »

 

Move JavaScript files to footer in WordPress

Loading excessive JavaScript files in the header will usually slow down your website. This happens because while JavaScript files are loading the browser stops all the other operations till those files have been processed.

An easily solution to remedy that is to move all the .js files in the footer so they will start to load after all the graphical elements of the website have been loaded. In order to do this, open your theme’s functions.php file an place the following code at the bottom.

Note: Keep in mind that in some cases some plugins might rely on specific JavaScript files to be loaded in the header, so make sure to check that everything is working properly (no errors in the java console) after moving all the files in the footer.

Share on FacebookTweet about this on TwitterShare on Google+Share on StumbleUponShare on LinkedInShare on RedditPin on PinterestShare on TumblrDigg thisPrint this pageEmail this to someone

5 Responses to Move JavaScript files to footer in WordPress

  1. ladymsk says:

    I have Sahifa wp theme, but no one trick with removing js and css to footer doesn’t workink

  2. Janmejai says:

    Tried it but the code messed up with whole Custom CSS,some other option?

    • CooLMinE says:

      That indicates that some of the JavaScript files perform changes to the CSS. It is a bit hard to troubleshoot more without more information.

      An alternative to the above method, which moves all the .js files to the footer is to do it manually and choose which ones you want instead.

      Keep in mind this will require you to manually remove the JavaScript files that you are adding to the footer from the header (so they won’t load twice) and also make sure the ordering is correct depending on their dependencies.

  3. Gucci says:

    very nice publish, i certainly love this website, keep on it

  4. louis says:

    You know I love your blog!!!

Leave a Reply

Your email address will not be published. Required fields are marked *