javascript - Bootstrap and css are not being recognized in my plugin -


i trying make own plugin on wordpress bootstrap , css don't work, there no connection being formed between them. here code, if have idea thankful.

 function my_options_style() {       wp_register_style('my_options_css', plugin_dir_url(__file__) . 'css/style.css', false, '1.0.0');       wp_register_style('bootstrap_options_css', plugin_dir_url(__file__) . 'includes/bootstrap-3.3.6-dist/css/bootstrap.min.css', false, '1.0.0');       wp_register_style('bootstrap_css', plugin_dir_url(__file__) . 'includes/bootstrap-3.3.6-dist/css/bootstrap-theme.min.css', false, '1.0.0');       wp_enqueue_style('my_options_css');       wp_enqueue_style('bootstrap_options_css');       wp_enqueue_style('bootstrap_css');      }      add_action('admin_enqueue_scripts', 'my_options_style');       function theme_scripts() {       wp_enqueue_script( 'my-ads', plugin_dir_url(__file__) . 'includes/bootstrap-3.3.6-dist/js/bootstrap.min.js', array(), '1.0.1', true );      }      add_action( 'wp_enqueue_scripts', 'theme_scripts' ); 

you need use wp_register_style() & wp_register_script()

demo for registers script

// register script function custom_scripts() {      wp_deregister_script( 'jquery' );     wp_register_script( 'jquery', '//code.jquery.com/jquery-2.1.1.min.js', false, '2.1.1', false );     wp_enqueue_script( 'jquery' );      wp_deregister_script( 'bootstrap' );     wp_register_script( 'bootstrap', '//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js', array( 'jquery' ), '3.2.0', false );     wp_enqueue_script( 'bootstrap' );  } add_action( 'wp_enqueue_scripts', 'custom_scripts' ); 

and register style

// register style function custom_styles() {      wp_register_style( 'bootstrap', '//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css', false, '3.2.0' );     wp_enqueue_style( 'bootstrap' );      wp_register_style( 'bootstrap-theme', '//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css', array( 'bootstrap' ), '3.2.0' );     wp_enqueue_style( 'bootstrap-theme' );  } add_action( 'wp_enqueue_scripts', 'custom_styles' ); 

for more details

https://developer.wordpress.org/reference/functions/wp_enqueue_style/

https://developer.wordpress.org/reference/functions/wp_enqueue_script/


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -