[wp-hackers] google jquery; wp fall back?

Barrett Golding bg at hearingvoices.com
Mon Nov 29 13:33:39 UTC 2010


following up on a question i asked here a month ago,
re: calling Google's CDN copy of jquery but falling back on WP's  
installed copy
(for the few times -- and countries -- when Google is unavailable.)

solution ended up being:

in header.php:
wp_enqueue_script( 'jquery' );

in footer.php:
<script type="application/x-javascript">!window.jQuery &&  
document.write('<script src="<?php echo site_url() . "/wp-includes/js/ 
jquery/jquery.js"; ?>"><\/script>')</script>

putting both in head did NOT work, but above method does. more info:
http://pubmedia.us/2010/11/calling-all-jquerys/

('course, also requires de-/re-registering 'jquery' in functions.php  
to get Google's copy.)

bg
-- 
<http://HearingVoices.com/>
~radio active transmissions~





More information about the wp-hackers mailing list