I am developing the plugin, and I would like to include bootstrap in my plugin. What is the best way to include? I couldn\'t find anything related to this, so far I have found s
Use bellow code in your plugins main PHP file. "wp_print_styles" action hook includes CSS styles. "wp_print_scripts" action hook includes java script. Use these two hooks to include Bootstraps Javascript and Style sheets in the plugin.
add_action( 'wp_print_styles', 'add_my_plugin_stylesheet' );
function add_my_plugin_stylesheet() {
wp_register_style('mypluginstylesheet', '/wp-content/plugins/postgrid/style.css');
wp_register_style('prefix_bootstrap', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css');
wp_enqueue_style('mypluginstylesheet');
wp_enqueue_style('prefix_bootstrap');
}
add_action('wp_print_scripts','add_my_plugin_js');
function add_my_plugin_js(){
wp_register_script('prefix_bootstrap', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js');
wp_enqueue_script('prefix_bootstrap');
}