Skip to content

Instantly share code, notes, and snippets.

@hsleonis
Last active March 2, 2016 11:19
Show Gist options
  • Select an option

  • Save hsleonis/8c8b41f0a4f613b4ca82 to your computer and use it in GitHub Desktop.

Select an option

Save hsleonis/8c8b41f0a4f613b4ca82 to your computer and use it in GitHub Desktop.
Change WordPress admin login logo, mouseover title and logo url.
<?php
// add this to your themes functions.php file
// change login image
add_action("login_head", "tmx_login_head");
function tmx_login_head() {
echo "
<style>
body.login #login h1 a {
background: url('".get_header_image()."') no-repeat scroll center top transparent;
height: ".get_custom_header()->height."px;
width: ".get_custom_header()->width."px;
}
</style>
";
}
// Change title for login screen
add_filter('login_headertitle', create_function(false,"return get_bloginfo('title');"));
// change url for login screen
add_filter('login_headerurl', create_function(false,"return home_url();"));
@hsleonis

hsleonis commented Mar 2, 2016

Copy link
Copy Markdown
Author

You'll need to add theme-support for 'header image' as well in your "after_setup_theme" action hook:

        // Add theme support for Custom Header
        $header_args = array(
            'default-image'          => get_template_directory_uri() . '/resources/img/logo.png',
            'width'                  => 140,
            'height'                 => 40,
            'flex-width'             => false,
            'flex-height'            => false,
            'uploads'                => true,
            'random-default'         => false,
            'header-text'            => true,
            'default-text-color'     => '#FFFFFF',
            'wp-head-callback'       => '',
            'admin-head-callback'    => '',
            'admin-preview-callback' => '',
        );
        add_theme_support( 'custom-header', $header_args );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment