Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save salvatorecapolupo/e7df08b6d8fc11e2e247f106e83ba894 to your computer and use it in GitHub Desktop.
Save salvatorecapolupo/e7df08b6d8fc11e2e247f106e83ba894 to your computer and use it in GitHub Desktop.
Correct way to recreate basic HTML file as targeted on "Get started" Bootstrap official page.
<?PHP
add_action('wp_enqueue_scripts', 'headwolf_enqueues' );
function headwolf_enqueues(){
//bootstrap.min.css
wp_enqueue_style('bootstrap2017', get_stylesheet_directory_uri() . '/css/bootstrap.min.css', array(), '3.3.7');
//HTML5 shim + Respond.js for IE8 support
global $wp_scripts;
wp_enqueue_script('modernizr-script', get_template_directory_uri() . '/js/vendor/modernizr.min.js', array(), '3.3.1');
wp_register_script('respond-script', get_template_directory_uri() . '/js/vendor/respond.min.js', array(), '1.4.2');
$wp_scripts->add_data('respond-script', 'conditional', 'lt IE 9');
wp_enqueue_script('respond-script');
wp_register_script('html5-shiv-script', get_template_directory_uri() . '/js/vendor/html5shiv.min.js', array(), '3.7.3');
$wp_scripts->add_data('html5-shiv-script', 'conditional', 'lte IE 9');
wp_enqueue_script('html5-shiv-script');
// bootstrap.js
wp_register_script( 'bootstrapscript', get_stylesheet_directory_uri() . '/js/vendor/bootstrap.min.js', array('jquery') );
wp_enqueue_script( 'bootstrapscript' );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment