Skip to content

Instantly share code, notes, and snippets.

@habibmac
Created June 6, 2012 15:28
Show Gist options
  • Save habibmac/2882639 to your computer and use it in GitHub Desktop.
Save habibmac/2882639 to your computer and use it in GitHub Desktop.
WP: Modify the login logo & image URL link
// This code will allow you to easily modify the WordPress Login page Logo as well as the href link and title text of this logo.
add_filter( 'login_headerurl', 'namespace_login_headerurl' );
/**
* Replaces the login header logo URL
*
* @param $url
*/
function namespace_login_headerurl( $url ) {
$url = home_url( '/' );
return $url;
}
add_filter( 'login_headertitle', 'namespace_login_headertitle' );
/**
* Replaces the login header logo title
*
* @param $title
*/
function namespace_login_headertitle( $title ) {
$title = get_bloginfo( 'name' );
return $title;
}
add_action( 'login_head', 'namespace_login_style' );
/**
* Replaces the login header logo
*/
function namespace_login_style() {
echo '<style>.login h1 a { background-image: url( ' . get_template_directory_uri() . '/images/logo.png ) !important; }</style>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment