[wp-hackers] Plugin conflicts with latest version of Jetpack

Mike Schinkel mike at newclarity.net
Wed Jan 2 07:06:07 UTC 2013


On Jan 2, 2013, at 12:03 AM, Otto <otto at ottodestruct.com> wrote:
> For CSS, I'd just include it all the time. Shouldn't make any speed
> difference, the browser loads it once, then it's browser-side cached.

If I'm not mistaken the browser still requests the file and the server returns a 304 telling the browser to use the cached version, at least that's what HTTPScoop[1] tells me. Having to check and getting a 304 response isn't the same as never having to issue an HTTP GET request and wait, especially if a site has many CSS and/or JS files to check from many different plugins.

On Jan 1, 2013, at 7:44 PM, Ian Dunn <ian at iandunn.name> wrote:
> The reason I'm checking if the shortcode is called is to avoid loading CSS and JavaScript files on pages where the shortcode isn't used <http://wordpress.stackexchange.com/questions/20854/conditionally-loading-javascript-css-for-shortcodes>. I didn't realize that we can use wp_enqueue_script() directly within the shortcode callback <http://scribu.net/wordpress/conditional-script-loading-revisited.html> now, but I originally wrote that method about 6 months before 3.3 came out. I could start doing that now for the JavaScript, but the CSS still needs to be enqueued inside the head tag, so it wouldn't really save me anything.


I've been meaning to tackle this same problem for a while and have been planning to use a technique that I described as an answer to your WordPress Answers question. Your question gave me the motivation to tackle it today:

http://wordpress.stackexchange.com/a/77946/89

Basically the approach I implemented checks for shortcode use on the first page load and then saves the status to a post meta key which it uses to check from them on.  Hope this helps and I'd be interested to know your thoughts on this approach.

-Mike
[1] http://www.tuffcode.com


More information about the wp-hackers mailing list