The only things I would change:
- You’re including a version of jQuery that is different than the one that is included with WordPress. You should de-register the WP version first so that aren’t 2 copies/versions of jQuery loaded on the page
- select2jquery should have jquery as a dependency so that you make sure is loaded after jQuery
- The 3rd parameter of wp_register_script if you’re not using should be by default an empty array
- The last parameter of wp_register_style is expecting the media for which this stylesheet has been defined and by default is ‘all’ (you’re passing a boolean true).
I would change to this:
function custom_scripts_css_with_jquery() {
wp_deregister_script('jquery');
wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js', array(), null, true);
wp_register_script( 'select2jquery', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js',array('jquery'), null, true );
wp_register_style( 'select2mincss', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css' ); // the rest of parameters are the default
// For either a plugin or a theme, you can then enqueue the style:
wp_enqueue_script( 'select2jquery' );
wp_enqueue_script( 'jquery' );
wp_enqueue_style( 'select2mincss' );
//wp_enqueue_script( 'Bootstrap_min_js');
}
add_action( 'wp_enqueue_scripts', 'custom_scripts_css_with_jquery' );