Call Chris at (615) 521-1890 for a free quote.
615.521.1890
Nashville Interactive - Home

Blog

Adding an Image or Logo to The WordPress Login Screen

Sep 9 2011

The difference is in the details. Here’s an easy script to add your site’s logo to the WP login screen. This will look for a logo.png file in your theme’s images directory but you can change that to whatever you’d like. The script automatically use the site name you entered in WP as the img title and will use your site’s url as the link. You will probably need to adjust the css to fit your logo or image dimensions accordingly. Enjoy…

//  changing the WP logo to something a bit sexier…

add_action(“login_head”, “my_login_head”);
function my_login_head() {
echo ”
<style>

body.login #login h1 a {
background: url(‘”.get_bloginfo(‘stylesheet_directory’).”/images/logo.png’) no-repeat scroll center top transparent;
display: block;
height: 80px;
left: 50%;
margin: 0 0 0 -56px;
width: 440px;
}

body.login #login h1 {
display: block;
margin: 0 auto;
}

body.login #login {
margin: 2em auto 7em;
width: 320px;
}

</style>
“;
}

// changing the title attr on the login logo
add_filter(‘login_headertitle’, create_function(false,”return ‘”.get_bloginfo( ‘name’ ).”‘;”));
add_filter(‘login_headerurl’, create_function(false,”return ‘”.get_bloginfo( ‘siteurl’ ).”‘;”));