How to Write Your Own Easy-Administration WordPress Plugin

Share this article

WordPress’s popularity owes much to it’s easy administration panels. Unfortunately, it can still be daunting for non-technical users such as your clients. At best they’ll require a little training, hand-holding and support. At worst, they’ll play around with plugin installation, edit some theme code, then expect you to clear up the mess.

I’ve written a number of “Make WordPress Easier for Clients” articles (see part 1 and part 2). In those examples, code was placed in the theme’s functions.php file. That’s still a viable solution if you have one WordPress installation per client or each is configured differently.

In this article, however, we’ll create a plugin. Plugins have a couple of advantages:

  1. Your code resides in one file which can make maintenance easier.
  2. If you’re running a WordPress network with multiple sites (previously known as WordPress MU), you can activate a single plugin across the network so it’s applied to every site.

WordPress Plugin Basics

Our plugin will be contained in a single PHP file. We’ll name it easy-admin.php and place it in the WordPress plugin folder (wp-content/plugins/). Ideally, the file should be UTF-8 encoded. If your text editor doesn’t permit UTF-8, well, use a better editor! That said, those using English are unlikely to experience issues with ANSI-encoded files.

A PHP tag and header comments are required at the top of the file, e.g.


<?php
/*
Plugin Name: Easy Administration
Plugin URI: https://www.sitepoint.com/wordpress-easy-administration-plugin-1
Description: Simplifies WordPress administration panels.
Version: 1.0
Author: Craig Buckler
Author URI: http://optimalworks.net/
License: GPL2
*/

You can change the header details, but ensure the definition tags remain — WordPress uses them to recognize your plugin.

You can now install your plugin by activating it in the “Plugins” section of the WordPress administration panels. Those with a WordPress network can activate it for all sites in the “Network Admin” section. It won’t do anything yet, but you can now add whichever features you require…

The WordPress logo is lovely but few clients will care what CMS they’re using. It might be more helpful to show their site name. Append the following code to easy-admin.php; it replaces the login page logo with the name and uses a pleasing CSS3-letterpress text:


// login page logo
function custom_login_logo() {
	echo '<style>h1 a, h1 a:hover, h1 a:focus { font-size: 1.4em; font-weight: normal; text-align: center; text-indent: 0; line-height: 1.1em; text-decoration: none; color: #dadada; text-shadow: 0 -1px 1px #666, 0 1px 1px #fff; background-image: none !important; }</style>';
}
add_action('login_head', 'custom_login_logo');

WordPress alternative login page logo

Remove the WordPress Icon From the Administration Panel Header

The WordPress icon is shown next to the site name in the header. There’s nothing wrong with it but some clients will question why there’s a ‘W’ next to their site. To remove it, append the following code to easy-admin.php:


// remove administration page header logo
function remove_admin_logo() {
	echo '<style>img#header-logo { display: none; }</style>';
}
add_action('admin_head', 'remove_admin_logo');

Change the WordPress Administration Panel Footer Text

The footer provides links to WordPress, documentation and feedback. Few clients are likely to find it useful so you can replace it with your own support details. Append the following code to easy-admin.php and change the echo statement to output to a suitable message:


// change administration panel footer
function change_footer_admin() {
	echo 'For support, please call 123456 or email <a href="mailto:support@mysite.net">mailto:support@mysite.net</a>';
}
add_filter('admin_footer_text', 'change_footer_admin');

Remove the WordPress Admin Bar

The dark-gray Admin Bar was introduced in WordPress 3.1. Personally, I don’t find it particularly useful. It can also confuse clients; they may think all visitors can see the bar or use it to access dangerous features such as ‘Appearance’. Fortunately, we can remove it with one line in easy-admin.php:


// remove admin bar
add_filter('show_admin_bar', '__return_false');

That’s enough configuration for today. In my next WordPress post, we’ll add further functions to simplify the dashboard, post and page panels.

Craig BucklerCraig Buckler
View Author

Craig is a freelance UK web consultant who built his first page for IE2.0 in 1995. Since that time he's been advocating standards, accessibility, and best-practice HTML5 techniques. He's created enterprise specifications, websites and online applications for companies and organisations including the UK Parliament, the European Parliament, the Department of Energy & Climate Change, Microsoft, and more. He's written more than 1,000 articles for SitePoint and you can find him @craigbuckler.

WordPress
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week