Load JavaScript in Footer
-
Hello,
After crating a project archive for a client with Lay Theme, I am now trying to make it perform smoother and faster. GTmetrix tells me that my PageSpeed and YSlow Score are not great (Grades E and D), mostly because of the lack of file compression and CDN, as well as JavaScript parsing.
Is there a way of loading all the external scripts as part of the footer rather than in the site’s head section? And, if not, is it necessary for Lay Theme to load all the external resources before upon loading the site?
Thanks and best,
Lukas -
@lug said in Load JavaScript in Footer:
Is there a way of loading all the external scripts as part of the footer rather than in the site’s head section? And, if not, is it necessary for Lay Theme to load all the external resources before upon loading the site?
Hey @lug
Lay Theme has many different JavaScript files, some of which need to be loaded in <head>
Others can be loaded in the footer and they are.
I know this is not optimal but since Lay Theme has different Addons, their js is only loaded if the addon is installed and activated.Please try these things:
https://laytheme.com/documentation.html#speedingupAnd disable all plugins you don't use, even the Lay Theme ones you don't use.
You can also use a CDN plugin, but it would be better if you could instead just use a CDN of your webhost. Cause the CDN plugins often only upload your images to CDNs.
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it