recently I’ve been working on a project that requires a great deal of customization of the WordPress admin area. I never like to edit the core files, one there is no real need to and two – that really makes upgrading a pain – so here’s how i went about it.
Feel free to leave comments.
The functions.php file of your theme is a powerful little file – essentially it is a plugin (or plugins) that does not need to be activated. You can use the functions file to add any functionality to your theme, but it can also easily add functionality to the admin area. I wanted to call an additional style sheet if the user was not an administrator so that i could turn off some of the side panels (settings, tools, etc) in the admin area.
Here’s how i did it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <?php function customAdmin() { $url = get_settings('siteurl'); $url = $url . '/wp-content/themes/pulp/wp-admin.css'; echo <!-- custom admin css --> <link rel="stylesheet" type="text/css" href="' . $url . '" /> <!-- /end custom adming css -->'; } get_currentuserinfo(); // perform actions if the user is not admin if($current_user->user_level<10){ // add custom style sheet add_action('admin_head', 'customAdmin'); } ?> |
