Skip to content

Instantly share code, notes, and snippets.

@TwisterMc
Last active December 15, 2016 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TwisterMc/4c5a8ee03d87c86235c74d8a17af275c to your computer and use it in GitHub Desktop.
Save TwisterMc/4c5a8ee03d87c86235c74d8a17af275c to your computer and use it in GitHub Desktop.
Use the Logo from BeaverBiulder's settings for the WordPress login screen.
<?php
/**
* Custom Login
* Pulls the logo from the BeverBuilder's customizer settings.
*/
function bbLogo_login_logo() {
$LogoImage = get_theme_mod( 'fl-logo-image-retina');
if ( !$LogoImage ) {
$LogoImage = get_theme_mod( 'fl-logo-image');
}
if ( $LogoImage ) {
?>
<style type="text/css">
body.login div#login h1 a {
background-image: url(<?php echo $LogoImage; ?>);
padding-bottom: 0px;
margin-bottom: 0px;
background-size: 200px;
width: auto;
}
</style>
<?php } ?>
<?php }
add_action( 'login_enqueue_scripts', 'bbLogo_login_logo' );
function bbLogo_login_logo_url() {
return home_url();
}
add_filter( 'login_headerurl', 'bbLogo_login_logo_url' );
function bbLogo_login_logo_url_title() {
return get_bloginfo('name');
}
add_filter( 'login_headertitle', 'bbLogo_login_logo_url_title' );
@TwisterMc
Copy link
Author

The one downside to this code is that I have the background-size hard coded. That should be updated to be more dynamic in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment