WordPress custom Login page – HTML & CSS – SitePoint Forums
Hi All,
I used this code to customize the WordPress login page by changing the logo and background image.
I need to know if this code has an error? Because the part for the style code is not highlighted in the text editor, it is blank and inactive.
<?php
/*Change Logo & Background*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
function wp_loginpage_logo_and_background() { ?>
<style>
.login {
background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url(
http://website.com/wp-content/uploads/2022/04/background-image.png; /*link to background image*/
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
transition: background 0.5s linear;
}
#loginform {
border-radius: 8px;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}
#login h1 a, .login h1 a {
background-image: url(http://website.com/wp-content/uploads/2022/03/logo-image.png; /*link to logo image*/
height:114px;
width:320px;
background-size: 320px 114px;
background-repeat: no-repeat;
padding-bottom: 30px;
}
.login #nav a, .login #backtoblog a {
color: silver !important;
}
.login #nav a:hover, .login #backtoblog a:hover {
color: whitesmoke !important;
}
.login h1 a #logo-text {
display: none;
}
</style>
<?php }
add_action( 'login_enqueue_scripts', 'wp_loginpage_logo_and_background' );
function wp_loginpage_logo_and_background_url() {
return home_url();
}
add_filter( 'login_headerurl', 'wp_loginpage_logo_and_background_url' );
Thank you,
Where’s the closing bracket to the url?
There are a couple of those missing.
It should be this:
url(
http://website.com/wp-content/uploads/2022/04/background-image.png); /*link to background image*/
Related Posts