Custom logo on login form for WordPress

Custom logo on login form for WordPress

Sometimes you want to deliver a fully customized WordPress installation and theme, and this is a very simple fix that’ll step up your game.

By adding the following function into the functions.php file (or creating your own functions.php file for a child theme), you are telling WordPress to grab the logo from somewhere else in order to integrate the login form into the whole corporate image.

function my_login_logo() { ?>
    <style type="text/css">
        body.login div#login h1 a {
            background-image: url('url_to_image');
            padding-bottom: 20px;
            background-size: imgWidth_px imgHeight_px;
            height: imgHeight_px;
            width: imgWidth_px;
        }
    </style>
}
add_action( 'login_enqueue_scripts', 'my_login_logo' );

Be sure to change imgWidth_ and imgHeight_ with the width and height of your logo.

If imgWidth_ is greater than 320 pixels, compute and add in a margin-left to center it:

margin-left: (imgWidth-320)/2;
Las Vegas Strip Walk

Next Article

Las Vegas Strip Walk

No Comments

Cancel