- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I have plugin I would like to use only on the contact page, however the script and css is being loaded on every page. Aside from the increased http requests, it is also causing another script to not work properly on another page.
Is there a way to stop this plugin from loading anywhere else on the site?
I know how to do this with normal scripts in the header, but I am not sure how to do this with a plugin that automatically injects scripts into the header.
Thanks in advance.
You can simply do this with a PHP if-statement. I wouldn’t use a plugin for this.
If is contact page > echo this script
@Htmlmainiac thanks but I don’t think that’s the purpose of that plugin. Yeh @chrisburton I decided to go with this solution…
http://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/
You edit the wp.config file with the scripts you wish to not load…
define(‘WPCF7_LOAD_JS’, false);
…and then manually enqueue them on the pages you wish to load the script.
Nice.