Any official way to create an admin theme?
-
16-10-2019 - |
Question
I was wondering whether there's a common way of customising the aspect of the admin panel. I know you can play with the css and js files but what I was looking for is some kind of "admin theme" like with drupal.
I´m asking so that you can personalize the admin panel while keeping your WP easily updateable.
Thanks in advance.
Solution
There is currently no way to create admin themes like Drupal. Here are some tips which cover most of the basic admin panel customization needs: http://www.cmurrayconsulting.com/wordpress-tips/customizing-wordpress-admin/
OTHER TIPS
You can create a plugin which makes changes to the admin dashboard. All you need to do is create two functions, one to change the top level toolbar, one to change the sidebar. Then you can add some css to style them and that should get you in the right direction.
// If you want to change top level admin/toolbar bar
add_action( 'wp_before_admin_bar_render', 'my_admin_bar_render' );
function my_admin_bar_render() {
global $wp_admin_bar;
// remove all top level toolbar items
foreach ($wp_admin_bar->get_nodes() as $node) {
$wp_admin_bar->remove_node($node->id);
}
$wp_admin_bar->add_menu( array(
'parent' => false,
'id' => 'my-logo',
'title' => '<img src="http://example.com/logo.png" alt="Blavatar" class="blavatar" height="16" width="16">',
'href' => "http://example.com"
));
$wp_admin_bar->add_menu( array(
'parent' => false,
'id' => 'my-toolbar-1',
'title' => 'Some toolbar item',
'href' => "http://example.com"
));
}
// If you want to change the side bar
add_action( 'admin_menu', 'my_admin_menu' );
function my_admin_menu() {
global $menu;
$menu = array(
array(
'My menu one',
'',
'http://example.com',
'',
'my-menu-class',
'',
'div'
)
);
}