Customizing WordPress Administration (from WordCamp Chicago)

Last weekend I debuted a new talk at WordCamp Chicago. Aimed at developers, Customizing WordPress Administration might have been a little bit dry, but the tips – many of them unique to this talk – are killer for consultants looking to tailor the other end of WordPress for their clients.

The slides are embedded below the fold, couresty SlideShare, but they won’t do you much good alone. The meat of the talk was a walk through a simple  Twenty-Ten child theme, the focal point being a functions.php file loaded to the gills with hooks and functions that customize the branding and admin experience. That download is also available below the fold!

A few of the tips we covered included:

  • Adding an admin stylesheet so you can restyle the back end – including the logo!
  • Renaming admin items by hooking translation functions (“Posts” became “Articles”)
  • Adding an “Admin Lite” role that can manage users, widgets, menus, and plug-ins, but can’t change the theme or settings
  • Removing unwanted post meta boxes, widgets, menu items, editor buttons, and more
  • Add a non-breaking space button (or if you “get” the code, any TinyMCE button) to the editor!
  • Adding additional contextual help – globally and on a screen by screen basis!
  • Styling the editor – globally, or unique to each post type!
  • Add an ID column to the list of posts
  • Add a dashboard widget with your own company’s RSS fee

The functions.php script is commented in detail, so even if you don’t really understand how the code works, you can work some copy and paste magic. In the spirit of open source, this child theme is completely GPL – I’d love to see these ideas propagate in the community and strengthen WordPress’ reputation as one of the easiest, friendliest CMS’s. I do ask that if you use some or all of the code in a theme, that you provide a friendly attribution in the source code to this post and yours truly.

The slides

The download

In the interests of looking forward, the theme was built on WordPress 3.0. It was tested and presented using RC2. Certain tips will not work on earlier versions.

It’s built as a child theme to Twenty-Ten, the default WordPress 3.0 theme, but it should work with just about any theme. Just edit the style.css and change the parent theme.

Download the Custom WP Admin Twenty-Ten child theme now!

Finally, a few responses to some of the feedback and questions I received.

Several of these hooks and functions could be simplified into fewer lines of code if you’re comfortable using lambda style functions. There’s an example of this commented out (with a note) in the code. I approached the code from a “verbose” and “clear” perspective – for training – rather than a minimalistic perspective.

Jane Wells commented that she liked the teal styling of the admin footer and header in my example admin skin, but thought it clashed with the remaining gray tones. She’s absolutely right – but I didn’t have a fully re-skinned admin stylesheet available. I just wanted to get the idea across so that others could get started on their own admin skins.

A member of the audience cleverly observed that my “Admin Lite” role had user management rights – so they could always make themselves a full admin. True. I could strip out the full admin choice from the role drop down too, but the point wasn’t really to lock down the intrepid client. The point of the “Admin Lite” account is to help a typical client by getting the features they don’t want to worry about out of their hair.

Another savvy attendee pointed out that unwanted meta boxes and dashboard widgets could be removed (well, hidden) by opening the “Screen Options” panel and unchecking items. Again, true. But that only holds for that one user who is logged in. What if the site manager plans to add many authors?

Several attendees asked about removing widgets, meta boxes, dashboard widgets, etc added by other plug-ins or themes. Yes, you can. Your theme’s functions.php runs last (unless it’s a child theme, in which case the parent theme’s functions.php runs last). If you’re comfortable digging around the plug-in’s code, find the add_action(‘hook_name’, ‘callback_name’) that adds the widget/box and put remove_action(‘callback_name’) in your functions.php. Or, for meta boxes, just find it’s ID by inspecting the box’s HTML, and use the “remove_meta_box” functions demoed in my child theme’s functions.php.

Sharing is Caring

Have you used these tips to refine and customize WordPress admin? Drop in a comment with a link to an image so we can see how you’ve finessed the oft-neglected side of WordPress for your client or website!

2 Responses to “Customizing WordPress Administration (from WordCamp Chicago)”

  1. [...] Scott Robbin – s Multi-Site – Domain Mapping Andrea Rennick – zing WP Administration (Smashing Magazine article mentioned) Jake Goldman – ess SEO Optimization [...]

  2. astrotim says:

    Awesome! I’ve been looking for a simple way to rename the “Posts” menu to something more meaningful for each individual client and I finally found it here! Plus a whole bunch of other great admin stuff.

    Going further, are there additional parameters to change the “Add New Post” heading? For example if I rename “Posts” to “News Posts”, it generates the heading “Add New News Post”, which is logically correct but us humans find it a bit weird.

    I love the functions for removing features here too – the power of Wordpress is so exciting for us webbies but for most there is way too much going on back there.

    Great work.