Australia's Leading Digital Marketing Experts. T. 1300 235 433  |  Aggreagtion Enquires Welcome

Custom Administration Login

If you're preparing a website for a client it's the little touches like these that count. The following code will replace the default wp-admin.php logo with one of your own choosing. If you're a control freak, this is just another means of branding your blog.

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin.

1
<?php 
2
/*
3
    Custom Administration Login Logo
4
    http://www.beliefmedia.com/code/wp-snippets/login-logo
5
*/
6
 
7
 
8
function beliefmedia_login_logo() { ?>
9
 
10
 <style type="text/css">
11
   body.login div#login h1 a {
12
   background-image: url(http://www.YourWebsite.com/images/custom_admin_logo.jpg);
13
   padding-bottom: 20px;
14
  }
15
 </style>
16
 
17
<?php }
18
add_action( 'login_enqueue_scripts', 'beliefmedia_login_logo' );

The size of your logo should be no bigger than 323 pixels wide by 67 pixels high. Adjust the above padding-bottom value to the spacing you want between your logo and the login form.

The above logo code doesn't remove the logo link to the WordPress website, nor does it remove the alt tag of "Powered by WordPress". The following two functions will take care of that.

The first function will change the logo link.

1
<?php 
2
/*
3
    Custom Administration Login Logo
4
    http://www.beliefmedia.com/code/wp-snippets/login-logo
5
*/
6
 
7
 
8
/* Custom Admin Logo Link */
9
10
 echo bloginfo('url'); /* Or another URL */
11
}
12
add_filter('login_headerurl', 'beliefmedia_change_wp_login_url');

The second function will customize the logo title and alt text.

1
<?php 
2
/* Custom WP Login Title */
3
4
 echo get_option('blogname'); /* Your own text */
5
}
6
add_filter('login_headertitle', 'beliefmedia_change_wp_login_title');

Like this article?

Share on facebook
Share on Facebook
Share on twitter
Share on Twitter
Share on linkedin
Share on Linkdin
Share on pinterest
Share on Pinterest

Leave a comment