- This topic has 2 replies, 2 voices, and was last updated 13 years, 4 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Support site for Tips and Tricks HQ premium products
by
Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Tweaks › Only load estore CSS/JS files when detecting shortcodes in posts, possible?
Tagged: js loading, page speed
Hey there – I can’t believe how far this plugin has come along and polished it is now! I do have a question though and that is, can we disable loading all of WP estore’s files (css/js… ie. wp_eStore_style.css, wp_eStore_custom_style.css, jquery.external.lib.js and jquery.lightbox-0.5.pack.js) when the post does not include any shortcodes/when we’re not selling anything? I’m trying to cut down on the page size to speed up loading times and with WP estore loading those file automatically on a Multisite installation, some of my sites/pages don’t need to have these files called. If there’s no method to detect whether a shortcode is being used in post, would there be any chance to build in some functionality where we can manually choose to load those files for each product/post? Maybe via a custom field value or something (true/false)?
I understand what you are trying to do but there is a better way to do this which is a standard practice.
You can use a plugin that combines all the javascript files on the page and loads that one file (this way instead of loading 10 different files you are loading 1 file that has the content of those 10 files). The same goes for CSS. Plugins like WP Minify, W3 Total Cache will allow you to do these things.
Ah yeah, I’ve already got those two running. I was just trying to make the page size smaller by excluding those calls on pages/posts that don’t need it, but it’s cool. Love the plugin