I personally like to use something like this. This will look for a logo
image in your templates /images/
folder or directory, then display it in place of the default WordPress Logo.
function my_login_logo() {
if(file_exists(TEMPLATEPATH.'/images/logo.png'))
$logo = '/images/logo.png';
else if(file_exists(TEMPLATEPATH.'/images/logo.jpg'))
$logo = '/images/logo.jpg';
else if(file_exists(TEMPLATEPATH.'/images/logo.gif'))
$logo = '/images/logo.gif';
?>
<style type="text/css">
body.login div#login h1 a {
background-image: url(<?php echo get_bloginfo('template_directory').$logo; ?>);
padding-bottom: 40px;
background-size: auto;
width: auto;
height: auto;
}
</style>
<?php
}
add_action( 'login_enqueue_scripts', 'my_login_logo' );
Alternatively as @G.M. suggested in the comments, you could use a more child_theme
friendly approach like so:
function my_login_logo() {
$locate = locate_template( array('images/logo.png', 'images/logo.jpg', 'images/logo.gif'), false );
if ( empty($locate) ) return;
$base = is_child_theme() && substr_count($locate , get_stylesheet_directory()) ? get_stylesheet_directory_uri() : get_template_directory_uri();
$logo = $base . '/images/' . basename($locate);
?>
<style type="text/css">
body.login div#login h1 a {
background-image: url(<?php echo $logo; ?>);
padding-bottom: 40px;
background-size: auto;
width: auto;
height: auto;
}
</style>
<?php
}
add_action( 'login_enqueue_scripts', 'my_login_logo' );
The following 2 functions will change where you get directed to once you click the logo banner, which in my first function I replace it with a link to the homepage.
The 2nd function will replace the hover text to the blog descriptoin that was set in Settings
as your Tag Line.
/** Change Banner Link **/
function custom_loginlogo_url($url) {
return home_url();
}
add_filter( 'login_headerurl', 'custom_loginlogo_url' );
/** Change Link Title to Tagline **/
function custom_login_logo_link_title(){
return get_option('blogdescription');
}
add_filter('login_headertitle', 'custom_login_logo_link_title');
All these need to be placed into function.php
for them to work.