Skip to content

Instantly share code, notes, and snippets.

@odil-io
Last active November 14, 2019 09:31
Show Gist options
  • Save odil-io/267d9b2a349268bee0269f4a150a36bc to your computer and use it in GitHub Desktop.
Save odil-io/267d9b2a349268bee0269f4a150a36bc to your computer and use it in GitHub Desktop.
WordPress: Easily 'White Label' /wp-admin/
<?php
add_action('login_head', function() {
$custom_logo_id = get_theme_mod( 'custom_logo' );
$logo = wp_get_attachment_image_src( $custom_logo_id , 'full' );
if ( has_custom_logo() ) {
echo '<style type="text/css">
.login h1 a {
background-image:url(' . esc_url( $logo[0] ) . ') !important;
background-size:contain;
width: 100%;
height: 84px; /* edit to your specification. Default is 84px. */
}
</style>';
}
});
add_filter( 'login_headerurl', function($url) {
return esc_url( get_bloginfo('url') );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment