Skip to content

Instantly share code, notes, and snippets.

@TwisterMc
Last active June 11, 2020 15:19
Show Gist options
  • Save TwisterMc/ab499ac43b712d908e9ad887a6dc8730 to your computer and use it in GitHub Desktop.
Save TwisterMc/ab499ac43b712d908e9ad887a6dc8730 to your computer and use it in GitHub Desktop.
Customize the WordPress login screen with the logo uploaded to Beaver Builder
<?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' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment