Add Bootstrap to WordPress admin sub-menu page

Add Bootstrap to a plugin page

// custom css and js
 add_action('admin_enqueue_scripts', 'cstm_css_and_js');

function cstm_css_and_js($hook) {
     // your-slug => The slug name to refer to this menu used in "add_submenu_page"
     // tools_page => refers to Tools top menu, so it's a Tools' sub-menu page
     if ( 'tools_page_your-slug' != $hook ) {
         return;
     }

    wp_enqueue_style('boot_css', plugins_url('inc/bootstrap.css',__FILE__ ));
     wp_enqueue_script('boot_js', plugins_url('inc/bootstrap.js',__FILE__ ));
 }

Leave a Reply

Your email address will not be published. Required fields are marked *

*