Created
October 22, 2018 07:21
-
-
Save savankaneriya/13d879d4e0653e065d7e5a3c07cf41ea to your computer and use it in GitHub Desktop.
Enqueue bootstrap-V4.1 to plugin or theme
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
/* Enqueue bootstrap-V4.1 to plugin or theme */ | |
function addBootStrapSupport($hook,$pageSlugs=array()){ | |
//dd($hook,$pageSlugs); | |
if(is_array($pageSlugs)&& !empty($pageSlugs)){ | |
$page = explode('_',$hook); | |
if(!in_array(end($page),$pageSlugs)){ | |
return; | |
} | |
} | |
wp_enqueue_style( | |
'bootstrap4', | |
'https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css' | |
); | |
wp_enqueue_style( | |
'wpb-fa', | |
'https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css' | |
); | |
wp_enqueue_script( | |
'jquery-cdn','https://code.jquery.com/jquery-3.3.1.slim.min.js', | |
array( '' ), | |
'', | |
true | |
); | |
wp_enqueue_script( | |
'popper', | |
'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js', | |
array( 'jquery-cdn' ), | |
'', | |
true | |
); | |
wp_enqueue_script( | |
'bootstrap-cdn', | |
'https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js', | |
array( 'jquery' ), | |
'', | |
true | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment