• 首页
  • 渗透
  • 折腾
  • 转载
  • 关于Me
  • 榜上有名
  • 文章存档
  • 友情链接

不妨看看这里

会员面板

Base64 Image

wordpress自定义登录页LOGO/背景图美化

  • Mr.Wu
  • 2018-04-21
  • 0
闲来无事就喜欢折腾这些小玩意,很简单也就不多解释了,代码来源于网络。

//自定义登录页面的LOGO图片
function my_custom_login_logo() {
    echo '<style type="text/css">
        .login h1 a {
        background-image:url("https://s.gravatar.com/avatar/c0182e19f4e87f7552aa9543b8d935ca") !important;
        height: 84px !important;
        width: 84px !important;
        -webkit-background-size: 84px !important;
        background-size: 84px !important;
        border-radius: 100px !important;
        }
        .login #backtoblog a, .login #nav a {
        color: #fff;
        text-decoration: none;
        }
        .login #backtoblog a:hover, .login #nav a:hover, .login h1 a:hover {
        color: #f44336;
}
    </style>';
}
add_action('login_head', 'my_custom_login_logo');

//自定义登录页面的LOGO链接为首页链接
add_filter('login_headerurl', create_function(false,"return get_bloginfo('url');"));
//自定义登录界面LOGO链接为任意链接
function custom_loginlogo_url($url) {
  return 'https://www.mrwu.me'; //修改URL地址
}
add_filter( 'login_headerurl', 'custom_loginlogo_url' );

//自定义登录页面的LOGO提示为网站名称
add_filter('login_headertitle', create_function(false,"return get_bloginfo('name');"));
//自定义登录页面LOGO提示为任意文本
function custom_loginlogo_desc($url) {
    return 'Mr.Wu博客'; //修改文本信息
}
add_filter( 'login_headertitle', 'custom_loginlogo_desc' );

//BING美图作为登录页面背景
function custom_login_head(){
$str=file_get_contents('https://cn.bing.com/HPImageArchive.aspx?idx=0&n=1');
if(preg_match("/<url>(.+?)<\/url>/ies",$str,$matches)){
$imgurl='https://cn.bing.com'.$matches[1];
    echo'<style type="text/css">body{background: url('.$imgurl.');width:100%;height:100%;background-image:url('.$imgurl.');-moz-background-size: 100% 100%;-o-background-size: 100% 100%;-webkit-background-size: 100% 100%;background-size: 100% 100%;-moz-border-image: url('.$imgurl.') 0;background-repeat:no-repeat\9;background-image:none\9;background-size:cover}</style>';
}}
add_action('login_head', 'custom_login_head');
© 2025 MrWu
Theme by Wing-child
  • {{ item.name }}
  • {{ item.name }}