Created
December 29, 2021 06:09
-
-
Save warderer/efed38a2b32f4ffc8d856fb80da197a5 to your computer and use it in GitHub Desktop.
[Custom Logo and Background on Wordpress Login] Simple enhacement changing the wp-login view with a custom logo and a background color via template functions.php on #wordpress
This file contains hidden or 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
| /* = Customize login page | |
| Reference: https://sgwebpartners.com/es/how-to-customize-login-logo-on-wordpress/ | |
| ---------------------------------------------------- */ | |
| function sgwp_custom_login_logo(){ | |
| echo | |
| "<style type='text/css'> | |
| body.login { background-color: #00629e; } //LOGIN BACKGROUND COLOR HERE | |
| body.login h1 a { background-image: url(". get_site_url() ."/wp-content/uploads/2021/00/LOGO_FILE_URL_HERE.PNG); | |
| background-size: 162px 80px; width: 162px; height: 80px; } | |
| body.login p#backtoblog, body.login p#nav, body.login .privacy-policy-page-link { background-color: white; margin-top:0px; margin-bottom: 0px; padding: 15px 15px; } | |
| body.login .privacy-policy-page-link { padding: 15px 0; } | |
| </style>"; | |
| } | |
| function sgwp_custom_login_url(){ | |
| return get_option('home'); | |
| } | |
| function sgwp_custom_login_title(){ | |
| return get_option('blogname'); | |
| } | |
| add_action('login_head', 'sgwp_custom_login_logo'); | |
| add_filter('login_headerurl', 'sgwp_custom_login_url'); | |
| add_filter('login_headertext', 'sgwp_custom_login_title'); | |
| function is_login_page(){ | |
| return in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php')); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment