Main Content

Automatically customize the WordPress login screen with the logo uploaded to Beaver Builder.

In my ongoing Beaver Builder tips posts, here’s one to easily brand the WordPress login screen with the logo uploaded to Beaver Builder.

WP Admin - Your Logo Here

<?php
/**
* Add Beaver Builder logo to login screen.
*
* @action login_enqueue_scripts
*/
function nerd_login_logo() {
$logo_image = get_theme_mod( 'fl-logo-image-retina' );
if ( ! $logo_image ) {
$logo_image = get_theme_mod( 'fl-logo-image' );
}
if ( $logo_image ) :
?>
<style type="text/css">
body.login div#login h1 a {
background: url(<?php echo esc_url( $logo_image ); ?>) no-repeat center center;
padding: 0px;
margin-bottom: 0px;
background-size: 200px;
width: auto;
background-color: #ffffff;
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
}
</style>
<?php
endif;
}
add_action( 'login_enqueue_scripts', 'nerd_login_logo' );
/**
* Filter the login header URL.
*
* @filter login_headerurl
*
* @return string|void
*/
function nerd_login_logo_url() {
return home_url();
}
add_filter( 'login_headerurl', 'nerd_login_logo_url' );
/**
* Filter the login header title.
*
* @filter login_headertext
*
* @return string|void
*/
function nerd_login_logo_url_title() {
return get_bloginfo( 'name' );
}
add_filter( 'login_headertext', 'nerd_login_logo_url_title' );

Just drop the code into the functions.php file.

It should be as simple as that. If there is a retina logo, it’ll use that one, if not, it’ll use the normal one. And if there isn’t a logo, it’ll just update the URL on the WordPress logo.

A quick update brings some nice personalization.

3 Responses

  1. Harvey MORGAN says:

    Thomas, is this for the Beaver Builder Theme? Doesn’t seem to work for GeneratePress.

Leave a Reply