Customizing the WordPress Admin: The Login Screen

The WordPress login screen is well designed - it's clean and simple to interact with and it works well on all screen sizes. But what if you're building a site for a client who wants to display their own logo to users logging in? Or if you have a MultiSite installation and want your users to see your branding when they log in? Luckily, you can customise the way the login screen looks quite easily.

For this tutorial I've created a plugin to do this; the advantage of using a plugin is that you can drop it into any WordPress sites you develop and instantly give them some branding.

The steps I'm going to demonstrate in this tutorial are:

  1. Adding a custom logo
  2. Styling the login screen - the logo, links and buttons

What You Will Need to Complete This Tutorial

To complete this tutorial you will need:

  • A WordPress installation
  • Access to your site's plugins folder to add your plugin
  • A text editor to create your plugin.

Setting Up the Plugin

At the top of my plugin I'm adding the following lines:


1. Add a Custom Logo

It's easy to add your own or your client's logo to the login page and instantly make your WordPress installation look more professional.

  1. First, create a folder called media inside your plugin folder, and upload your logo to it.
  2. In the plugin file (or functions file), add the following function, attaching it to the login_enqueue_scripts action hook:

This will add your logo to the login screen, as shown the the screenshot.

customizing-the-wordpress-admin-part1-login-screen-with-custom-logo

2. Style the Login Screen

As well as adding a logo you can also resize it to fit and add styling for other elements in the screen.

Styling the Logo

The logo above is slightly squashed in order to fit in the default space given for it. I'm going to adjust the sizing.

Edit the code in your plugin so it reads as follows:

The height value you use will depend on the aspect ratio of your logo. Using 300px and auto for the background-size property ensures that your logo is as wide as the login box and that its aspect ratio is retained, and the height value will provide enough space for your logo to fit in.

Now my logo looks like this:

customizing-the-wordpress-admin-part1-login-screen-with-custom-logo-resized

Much better! But sizing the logo isn't the only thing I can do with regard to styling. How about changing some colors?

Styling Links

All of the text displayed on the login page is in the form of links, so it's links you'll have to style. Edit your code again so it reads as follows:

This gives me links which are in keeping with my logo colors. The link color is cyan and the hover color is magenta.

customizing-the-wordpress-admin-part1-login-screen-with-restyled-links

Note: As my logo's main color is similar to blue, it works well for links. You may not want to change the color of your links if your logo is a very different color, to avoid usability problems.

Styling the Button

The final element on the screen is the 'Log In' button, which is still blue. Let's change that. Edit your code so it reads as follows:

So I now have a completely customized login screen, meaning that when my clients or users log in, they see something that's consistent with my brand and makes the site look more professional.


Summary

Customizing the WordPress login screen is straightforward and can make a big difference to the impression your site gives to users and clients logging in. By tweaking the code above to meet your needs and reflect your brand you can create a very professional login screen in very little time.

Tags:

Comments

Related Articles