wordpress纯代码实现更改自定义登陆页面样式的方法,在主题文件function.php文件中添加如下代码
//自定义登录页面的LOGO图片
function my_custom_login_logo() {
echo '
<style>
.login {
background-attachment: fixed;
background-position: center center;
background-size: cover;
background-image: url(/wp-content/uploads/2021/10/2021102501423853.jpg);
padding-left: 30px;
padding-right: 30px;
}
.login h1 a{
background-image: url(/wp-content/uploads/2021/10/2021102501431767.png);
background-size: 100%;
width: 62%;
}
.login form{padding: 38px 38px 34px;}
#login{
width: 30.6666% !important;
margin-top: 0px !important;
margin-bottom: 0px !important;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}</style>';
}
add_action('login_head', 'my_custom_login_logo');
//更改login-logo链接为网站首页
add_filter('login_headerurl', create_function(false,""));