Load jQuery from Google AJAX Libraries API in Wordpress with "fallback
script"
I have added a Wordpress function to load jQuery Library from Google
Hosted Libraries
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
wp_deregister_script('jquery');
wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ?
"s" : "") .
"://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js", false,
null);
wp_enqueue_script('jquery');
}
it create the something like this
<script
src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
how can I include it with fallback option, as per html5boilerplate suggested
<script
src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script
src="js/vendor/jquery-1.9.1.min.js"><\/script>')</script>
like this
No comments:
Post a Comment