Add this to the functions.php of the active theme.
/**
* Load Bootstrap CSS and JS from MaxCDN - the right way
*
* @refer https://millionclues.com/wordpress-tips/load-css-and-js-the-right-way/
*/
function mcabl1226_load_css_and_js() {
// Load Boostrap CSS
wp_enqueue_style( 'bootstrap-css', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css' );
// Load Theme's style.css
wp_enqueue_style( 'style', get_stylesheet_uri() );
// Load Boostrap JS
wp_enqueue_script( 'bootstrap-js', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js', array('jquery'), '1.0', true);
}
add_action( 'wp_enqueue_scripts', 'mcabl1226_load_css_and_js' );
To quickly develop a WordPress theme using Bootstrap 4, checkout my Bootstrap 4 starter theme on Github.
Leave a Reply