Reputation: 29
I am developing a website in WordPress 4.3. In this we use more than 20 plugins. The CSS and jQueries of every plugin are loaded on every page.
My question is: how can I optimize the styles and jQueries in that way the required styles and jQueries are included on each page.
I am trying wp_enque_script()
but cannot get success. Also I am going to do that, include CSS and jQuery on each page that they required. But I think this is not a better way.
URL of my website is: http://omtut.com/
Upvotes: 0
Views: 487
Reputation: 639
You can try to use conditional logics. Ex: if you need to include "homepage.js" only on home page, you may try
if(is_home()){
// use wp_enque_script() function to include the said js file
}
Likewise you can include only the required js/css files in each page.
Upvotes: 1