Customizing WordPress Administration (from WordCamp Chicago)

oomphinc

June 10, 2010

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…

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!

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 feed

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.

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!

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.

Anyway to force users to use the Grey Admin Color Scheme through the functions.php theme file? I know of a lot of plugins that would work, but I’d like to just have it as a default for the theme. The goal is to prevent users from using the Blue theme so I only have to custom brand one stylesheet.

I am trying to remove the Tools menu completely as it only contains the Press This feature which my users do not need. How can I do this? I already specified import and export as false in my new role definition but Tools>Tools still appears.

Here’s a tip for people doing CMS-sites for clients whom insists on having full-access to all pages in the admin GUI. When you cannot dissuade them do comply but make sure there’s a warning provided on pages they shouldn’t tamper with.

The condition [strpos($_SERVER[‘PHP_SELF’], ‘options-‘] makes sure the warning message is only displayed on admin-pages that include the phrase “options-” in their path. Meaning: all submenus under “Settings”.

You could easily adjust the conditions to provide a notice on other pages. Quite useful for that critical information the client has to read (because in my experience no one clicks on the “Help” button).

This is great, thanks. I am wondering if you can point me in the right direction to do what I see in slide 5 of your presentation. You created your own tab in the sidebar and then links on the dashboard to add content to that tab (Green Projects, Marketplace, etc).