Skip to content

Instantly share code, notes, and snippets.

@kenmasters
Forked from mrbobbybryant/gist:83c4a076da6dd67de3da
Last active December 7, 2017 02:04
Show Gist options
  • Save kenmasters/a259e1d3e9439eadb6f5b5b1e4815069 to your computer and use it in GitHub Desktop.
Save kenmasters/a259e1d3e9439eadb6f5b5b1e4815069 to your computer and use it in GitHub Desktop.
Properly enqueue Bootstrap(CSS/JS) into WordPress CMS
<?php
/**
* Enqueue scripts and styles
*/
add_action( 'wp_enqueue_scripts', 'your_theme_enqueue_scripts' );
function your_theme_enqueue_scripts() {
// all styles
wp_enqueue_style( 'bootstrap', get_stylesheet_directory_uri() . '/css/bootstrap.css', array(), 20141119 );
wp_enqueue_style( 'theme-style', get_stylesheet_directory_uri() . '/css/style.css', array(), 20141119 );
// all scripts
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '20120206', true );
wp_enqueue_script( 'theme-script', get_template_directory_uri() . '/js/scripts.js', array('jquery'), '20120206', true );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment