Last active
December 15, 2016 16:51
-
-
Save TwisterMc/4c5a8ee03d87c86235c74d8a17af275c to your computer and use it in GitHub Desktop.
Use the Logo from BeaverBiulder's settings for the WordPress login screen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.