Solved

Scripts & Style Sheets only used on required pages.

Posted on 2014-02-12
7
275 Views
Last Modified: 2014-02-13
Some of my wordpress websites have many plugins which generate lots of links to Scripts & Style Sheets.

Some of these Scripts & Style Sheets are only required on one page however Wordpress links to them on every page usually via the header.

Does anyone know of a method or plugin to restrict Scripts & Style Sheets used only the ones used on the relevant page?
0
Comment
Question by:petewinter
  • 3
  • 3
7 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 39854374
How is the "relevant page" to be determined?  All WordPress knows is that you have installed something.
0
 

Author Comment

by:petewinter
ID: 39854413
Open to idea's. Can it be done via template?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 39854573
Sort of.  The issue is that the plugins are the ones adding the calls to the files so any solution involving conditional code would probably involve altering the plugin.  Once you do that, you either have to fork it or not update it as the next update will blow away any changes.
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39854932
Why do you want to do this?  What is your goal?
0
 

Author Comment

by:petewinter
ID: 39855453
I want to reduce calls and help page speed
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 500 total points
ID: 39855461
The better way to do this may be to minify and combine CSS and JS files.  W3 Total Cache can do it or you can hook onto a CDN service that will do it too.
0
 

Author Closing Comment

by:petewinter
ID: 39855602
Okay. Thanks for the advice
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question