I had a hard time finding the correct way to do this. I want to load the CDN resources here: http://www.bootstrapcdn.com/ but use wp_enqueue_scriptswp_enqueue_scripts
and have local fall backfallback.
This is the method I am using for local fall back now directly in header.php: window.jQuery || document.write('\x3C/script>')
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery.js">\x3C/script>')</script>
I want something like this for all resources but also using wp_enqueue_scripts. I successful switched the enqueue Jquery using this method but this does not provide a fallback: /** Jquery **/ wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js','', 'latest', true ); wp_enqueue_script('jquery','','',true);
/** Jquery **/
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.5./jquery.min.js','', 'latest', true );
wp_enqueue_script('jquery','','',true);
Any help is greatly appreciated!