I am facing difficulty applying Bootstrap to my custom dashboard widget.

function admin_theme_style() {
    if( is_admin() ) {
        wp_enqueue_script('bootstrap-script', plugin_dir_url($this->_FILE_) . 'includes/js/bootstrap.min.js');
        wp_enqueue_script('jquery-ui-core', false, array('jquery'));
        wp_enqueue_script('google-platform', '//apis.google.com/js/platform.js', array('jquery'));
        wp_enqueue_style('webinar', plugin_dir_url($this->_FILE_) . 'includes/css/webinar.css');
        wp_enqueue_style('bootstrap', plugin_dir_url($this->_FILE_) . 'includes/css/bootstrap.css');    

add_action('admin_enqueue_scripts', array($this,'admin_theme_style');

For the plugin, scripts and CSS gets loaded correctly.

  • I'm not sure of your $this->_FILE_ syntax. Also, I'm not sure Bootstrap's JavaScript should be enqueued before it's CSS.
    – Max Yudin
    Mar 8, 2017 at 18:57

1 Answer 1


Well, the add_action() should be

add_action( string $tag, callable $function_to_add, int $priority = 10, 
            int $accepted_args = 1 ) 

You've got the tag and then you have an array. That array should just be a string of 'admin_theme_style'. That should call the entire function.


Simply try:

add_action('admin_enqueue_scripts', 'admin_theme_style');
  • As you could guess, the OP's code belongs to a class. So, you are wrong.
    – Max Yudin
    Mar 8, 2017 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.