Skip to main content

How to Make WordPress Easier for Clients, Part 1: Custom Branding

By Craig Buckler

Programming

Share:

Free JavaScript Book!

Write powerful, clean and maintainable JavaScript.

RRP $11.95

WordPress is one of the web’s most popular Content Management Systems. The appeal is obvious: it’s flexible, it’s easy to create custom templates, it offers a huge quantity of plugins, hundreds of themes are available, the application is open source and it’s free. It’s also relatively simple for clients to understand — that’s one of the main reasons I use it.I recently posted the article Do Your Clients Use Their CMS? I concluded that many CMSs can be daunting, appear technical, use jargon, or offer too many superfluous options. WordPress may be one of easier systems but it could be simplified further. Fortunately, we can address many issues with a little PHP magic.Easier WordPressIn this series of articles we’ll implement several options to make WordPress easier for your clients. You can probably find plugins to achieve the same thing, but this code is easy, flexible, and won’t need to be updated (unless you want to make updates yourself).

functions.php

The following WordPress modifications change your theme’s functions.php file. This file is optional and it’s automatically loaded when you view an administration page or the website itself. The file is normally used to define regularly-used template functions, but it can also implement plugin-like behavior.Since functions.php is activated with your theme, it’s easy to distribute between WordPress installations without having to download, enable or update plugins. If your current theme does not contain a functions.php file, simply create one and add PHP delimiters:

<?php// code will go here?>
tip: PHP delimiters

The closing “?>” isn’t strictly necessary and many PHP developers will tell you that it shouldn’t be used — but that’s a topic for another article!

Changing the WordPress login logo

There’s nothing wrong with the WordPress logo, but few clients will care what CMS they’re using. Why not use their logo or branding?The logo file is /wp-admin/images/logo-login.gif. Although you can remove or change that file, it will reappear whenever you update WordPress. Here’s a better solution:1. Create/obtain your client’s logoIt’s best to resize the image so it’s no larger than 326 x 82 pixels. Copy the image file to your theme folder — in the following code, we’ll assume it’s named logo.png.2. Update your theme’s function.php filePlace the following code in function.php to change the default logo. Remember to modify the logo.png file reference if you named it differently.

// login page logofunction custom_login_logo() {	echo '<style type="text/css">h1 a { background: url('.get_bloginfo('template_directory').'/logo.png) 50% 50% no-repeat !important; }</style>';}add_action('login_head', 'custom_login_logo');

Removing WordPress update notifications

The WordPress administration panels inform you when a new version is available. Unfortunately, it tells everyone — including your clients. That could lead to unnecessary concern or persuade them contact you every half an hour until the update is applied.Add the following code to your theme’s functions.php file to disable the update notification for everyone except WordPress administrators:

// remove upgrade notificationfunction no_update_notification() {	remove_action('admin_notices', 'update_nag', 3);}if (!current_user_can('edit_users')) add_action('admin_notices', 'no_update_notification', 1);

I hope you found those two examples useful. Further WordPress simplification ideas are available now…

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.

New books out now!

Learn valuable skills with a practical introduction to Python programming!


Give yourself more options and write higher quality CSS with CSS Optimization Basics.