There is a Custom Admin Branding plugin for that, but why bother when you can insert a few lines into your theme’s functions.php file? ๐
However, if you like to change up your site’s theme sometimes, you probably want to change the log in page too. A lot of people have been really hooked into branding their WordPress log in page, especially since guest blogging has become popular.
Here is the code I put together for Blondish.net. This is all merely adding CSS and an action to your theme’s functions.php file. (Note: some people like to be tidy and can put this in another file and reference it to the functions.php file.)
Adding the action for your custom login:
add_action('login_head', 'my_custom_login_logo');
Replace the WordPress logo:
function my_custom_login_logo() { echo '<style type="text/css"> .login h1 a { background-image:url('.get_bloginfo('template_directory').'/images/blondishnet-2011-bottom-logo.png) !important;height:80px;width:401px;margin-bottom:5px;no-repeat scroll center top transparent; }
Adding your own background to the login page:
html, body {background: url('.get_bloginfo('template_directory').'/images/blondishnet-bg.png) !important;}
Removing the Back to blog link:
#backtoblog { display:none; } </style>'; }
Customizing the login box area:
#login {width:401px !important;} .login form {background: url('.get_bloginfo('template_directory').'/images/blondishnet-bg2.png) !important;} .login label {color: #fff; font-size: 16px;} input.button-primary:active, button.button-primary:active, a.button-primary:active { background-color: #EEA2BB !important; background-image: none !important; color: #BA314C !important; border-color: #BA314C !important;} input.button-primary, button.button-primary, a.button-primary {background-color: #EEA2BB !important; background-image: none !important; color: #BA314C !important; border-color: #FAD5E1 !important;} .login #nav a, .login #backtoblog a {color: #BA314C !important;} .login #nav a:hover, .login #backtoblog a:hover {color: #000 !important;} </style>
Replacing the WordPress.org link that is on the login page (where you put your site’s name or logo):
<script type="text/javascript"> function loginalt() { var changeLink = document.getElementById(\'login\').innerHTML; changeLink = changeLink.replace("http://wordpress.org/", "' . site_url() . '"); changeLink = changeLink.replace("Powered by WordPress", "' . get_bloginfo('name') . '"); document.getElementById(\'login\').innerHTML = changeLink; } window.onload=loginalt; </script>
Now, the full code in action:
add_action('login_head', 'my_custom_login_logo'); function my_custom_login_logo() { echo '<style type="text/css"> .login h1 a { background-image:url('.get_bloginfo('template_directory').'/images/blondishnet-2011-bottom-logo.png) !important;height:80px;width:401px;margin-bottom:5px;no-repeat scroll center top transparent; } html, body {background: url('.get_bloginfo('template_directory').'/images/blondishnet-bg.png) !important;} #login {width:401px !important;} .login form {background: url('.get_bloginfo('template_directory').'/images/blondishnet-bg2.png) !important;} .login label {color: #fff; font-size: 16px;} input.button-primary:active, button.button-primary:active, a.button-primary:active { background-color: #EEA2BB !important; background-image: none !important; color: #BA314C !important; border-color: #BA314C !important;} input.button-primary, button.button-primary, a.button-primary {background-color: #EEA2BB !important; background-image: none !important; color: #BA314C !important; border-color: #FAD5E1 !important;} .login #nav a, .login #backtoblog a {color: #BA314C !important;} .login #nav a:hover, .login #backtoblog a:hover {color: #000 !important;} </style> <script type="text/javascript"> function loginalt() { var changeLink = document.getElementById(\'login\').innerHTML; changeLink = changeLink.replace("http://wordpress.org/", "' . site_url() . '"); changeLink = changeLink.replace("Powered by WordPress", "' . get_bloginfo('name') . '"); document.getElementById(\'login\').innerHTML = changeLink; } window.onload=loginalt; </script> '; }
You can customize more of the page too, so just view the source of your login page (or you can click “Inspect Element” in Chrome or Firefox to get view the element you need to change) and you can put other CSS attributes into the code above.
larry bobbert says
Saw your presentation on WordPress.tv and was impressed with your knowledge so came here to check you out.
Thanks
Kostas says
I was looking for something like this for a long time, I have a multi-author blog and I would certainly prefer it if my guest authors see a custom login page, it looks much more professional.
I only have one question, since I use Thesis theme can I use the same code at the functions.php editor or I should use a different code?
Thanks
Kostas
Nile says
You will have to add a hook and then that code in Thesis or in Genesis.
dev says
Hey that is really some serious customizing Great article thanks.
barrymackey says
thanks for the easy to understand information,just learning html
Kimberly Castleberry says
That’s pretty cool. Of course the standard policy applies that that stuff really should be done in a child theme (or custom functions/css file) so the code alterations aren’t lost when the theme is upgraded… but still far more efficient than a plugin. I like this!
Kim
Nile says
If you have a major framework, yes. However, if you are a developer that does from scratch, copy and paste the code over to the new theme’s functions.php. AND in the case they do develop that theme from scratch into a framework for all future work… definitely agree with you.
Igor Kopmar says
Well I think that this code will give a nice response to my wordpress page,
I wil try this
Linda Campbell says
Excellent tips but I personally don’t allow other people to login into my blog so this wouldn’t be something I want to dig in and modify ๐
Arjun Rai says
Amazing information, These codes are very useful for those who know little about development and designs ever non developers can also use this code.
Gautham says
I always though the login page was static and uncustomizable, Thanks for this awesome technique to customize it without any plugin.