看看这里的CODEX 例如,如何做这件事。
Example: Load CSS File on All Admin Pages
function load_custom_wp_admin_style(){
wp_register_style( \'custom_wp_admin_css\', get_bloginfo(\'stylesheet_directory\') . \'/admin-style.css\', false, \'1.0.0\' );
wp_enqueue_style( \'custom_wp_admin_css\' );
}
add_action(\'admin_enqueue_scripts\', \'load_custom_wp_admin_style\');
Example: Target a Specific Admin Page
function my_enqueue($hook) {
if( \'edit.php\' != $hook )
return;
wp_enqueue_script( \'my_custom_script\', plugins_url(\'/myscript.js\', __FILE__) );
}
add_action( \'admin_enqueue_scripts\', \'my_enqueue\' );