Skip to content

Instantly share code, notes, and snippets.

@amitabhaghosh197
Created June 19, 2014 10:17
Show Gist options
  • Save amitabhaghosh197/8ea768411da4e0af5e85 to your computer and use it in GitHub Desktop.
Save amitabhaghosh197/8ea768411da4e0af5e85 to your computer and use it in GitHub Desktop.
cdn-function
<?php
$cdn_urls = @fopen('https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap.min.css', r);
$cdn_urls = @fopen('https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap-responsive.min.css', r);
if( $cdn_urls !== false)
{
//USE CDNS
function stepup_cdn_css()
{
wp_enqueue_style('bootstrap_css' , 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap.min.css', false);
wp_enqueue_style('bootstrap_responsive_css' , 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap-responsive.min.css', false);
}
add_action('wp_enqueue_scripts', 'stepup_cdn_css');
} //end of if
else
{
//USE internal
function stepup_local_css()
{
wp_enqueue_style ('bootstrap_css', TEMPLATE_DIRECTORY . 'css/bootstrap/bootstrap.css', false );
wp_enqueue_style ('bootstrap_responsive_css', TEMPLATE_DIRECTORY . 'css/bootstrap/bootstrap-responsive.css', false );
}
add_action('wp_enqueue_scripts', 'stepup_local_css');
}// end of else
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment