• Hey guys I found this snippet online to replace the login image but it isn’t working and I was wondering if someone with some php knowledge could explain why? I currently have a plugin to do the same thing but I am trying to reduce my plugins as the site is getting slower.

     function custom_login_logo() {
        echo '<style type="text/css">
            h1 a { background-image:url('.get_bloginfo('template_directory').'/images/login_logo.png) !important; }
        </style>';
    }
    add_action('login_head', 'custom_login_logo');

    What I am seeing is the standard wordpress logo with the styles showing in the top of the window. I have added this function in my child themes function.php file and created the images folder (and uploaded the appropriate image) also in my child themes directory.

    • This topic was modified 7 years, 12 months ago by nootkan.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey, you can use this code to change the login logo.

    function custom_login_logo() { ?>
        <style type="text/css">
            #login h1 a, .login h1 a {
                background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/images/my-custom-logo.png);
                padding-bottom: 30px;
            }
        </style>
    <?php }
    add_action( 'login_enqueue_scripts', 'custom_login_logo' );
    Thread Starter nootkan

    (@nootkan)

    Thanks very much for the snippet. Unfortunately the logo is so small you can barely see it. Using firebug I cannot find the file to stop it from scaling. I tried this in the snippet you gave me but that didn’t work either.

    #login h1 a, .login h1 a {
                background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/images/my-custom-logo.png);
                width:310px height:70px padding-bottom: 30px !important;
    Thread Starter nootkan

    (@nootkan)

    I had to abandon this as it doesn’t work without resizing the image. Went back to the plugin and will live with poor website speed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Help with Login Image Snippet’ is closed to new replies.