I’m trying to develop a WordPress theme and figure out how to provide a local fallback for Font Awesome if CDN fails or I develop my theme on a local server without internet connection.
The solution I have in mind is something like this (pseudo code):
if ( $CDN_IS_AVAILABLE ) {
wp_enqueue_style( 'font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', false );
} else {
wp_enqueue_style('font-awesome', get_template_directory_uri() . '/css/font-awesome/css/font-awesome.min.css', false, '4.0.3' );
}
Thanks.
How about this?
In addition to this, you could add wp_enqueue_script into the functions to do the same with JS.