daniel-w
8/19/2015 - 5:02 PM

Custom logo on Wordpress login page.

Custom logo on Wordpress login page.

/**
 * Custom logo on login page
 */
function custom_login_logo() {
	$custom_logo_id = get_theme_mod( 'custom_logo' );
	$image = wp_get_attachment_image_src( $custom_logo_id , 'full' );

	if($image) {
		echo '
		<style type="text/css">
			h1 a { 
				background-image: url(' . $image[0] . ') !important;
				background-size: auto !important;
				background-position: center !important;
				background-color: #505050 !important;
				width: 100% !important;
			}
		</style>';
	}
}
add_action('login_head', __NAMESPACE__ . '\\custom_login_logo');