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…



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 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.

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!

Categories: / /
Platforms:

15 Responses

  1. [...] Scott Robbin – @srobbinWordPress Multi-Site – Domain Mapping Andrea Rennick – @andrea_rCustomizing WP Administration (Smashing Magazine article mentioned) Jake Goldman – @jakemgoldWordPress 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.

  3. Awesome tips. Just watched your presentation at WordCamp MidAtlantic … Thanks a lot!

    -Anthony

  4. Scott says:

    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.

  5. [...] shared some fantastic tips explaining how to make these changes and more. The best part? He posted most of the tips on his blog, along with a package you can download and play with on your own [...]

  6. 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.

  7. [...] Jacob Goldman – Customizing WordPress Administration 4:30pm Keynote – Interview with Jane [...]

  8. Brian Lis says:

    Any chance you know how to make the dashboard widgets go on the right side?

  9. This was highly useful! Thank you for your hard work on this and the level of clarity in the code commenting.

  10. Carl says:

    This is golden! Thank you Murray!

  11. Carl says:

    A note:

    For change_post_to_article(), the function that changes the label “Post” into “Article”, it makes more sense to use the case-insensitive PHP-function instead of two case-sensitive ones.

    Instead of:
    $translated = str_replace( ‘post’, ‘article’, $translated );
    $translated = str_replace( ‘Post’, ‘Article’, $translated )

    It could be:
    $translated = str_ireplace( ‘Post’, ‘Article’, $translated );

  12. Carl says:

    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.

    add_action(‘admin_notices’,’settings_warning’);
    function settings_warning() {
    if ( current_user_can(‘manage_options’) && strpos($_SERVER['PHP_SELF'], ‘options-’) ) {
    echo ‘YOUR WARNING GOES HERE’;
    }
    }

    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).

  13. Adam says:

    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).

    Thank You