Last active
January 24, 2018 11:41
-
-
Save deeman/7b00d9c684a7586e8480c16d43f11db6 to your computer and use it in GitHub Desktop.
How to Enque Boostrap with WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Do NOT include the opening php tag shown above. | |
add_action( 'wp_enqueue_scripts', 'custom_load_bootstrap' ); | |
/** | |
* Enqueue Bootstrap. | |
*/ | |
function custom_load_bootstrap() { | |
wp_enqueue_style( 'bootstrap-css', '//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css' ); | |
wp_enqueue_script( 'bootstrap-js', '//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js', array( 'jquery' ), CHILD_THEME_VERSION, true ); | |
// Compiled versions | |
wp_enqueue_script( 'jquery-js', '//code.jquery.com/jquery-3.2.1.slim.min.js', array( 'jquery' ), CHILD_THEME_VERSION, true ); | |
wp_enqueue_script( 'jquery-js', '//cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js', array( 'jquery' ), CHILD_THEME_VERSION, true ); | |
} | |
// | |
//If CHILD_THEME_VERSION is not set in your child theme, it can be done like so: | |
// | |
//Copy to clipboard | |
//define( 'CHILD_THEME_VERSION', '2.3.0' ); | |
// To get the URLs of the current latest versions of css and js files, go: | |
// http://getbootstrap.com/docs/4.0/getting-started/download/#bootstrap-cdn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment