自定义WordPress登录背景

//自定义登录页面背景
function custom_login_head() {
    $str=file_get_contents('http://cn.bing.com/HPImageArchive.aspx?idx=0&n=1');
    if(preg_match("/<url>(.+?)</url>/ies",$str,$matches)) {
        $imgurl='http://cn.bing.com'.$matches[1];
        echo'<style type="text/css">body{background: url('.$imgurl.');background-attachment:fixed;width:100%;height:100%;background-image:url('.$imgurl.');background-attachment:fixed;-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-attachment:fixed;background-repeat:no-repeat9;background-image:none9;}h1 a { background-image:url('.get_bloginfo('url').'/favicon.ico)!important;width:32px;height:32px;-webkit-border-radius:50px;-moz-border-radius:50px;border-radius:50px;}#loginform {background-color:rgba(251,251,251,0.3)!important;}.login label,a{color:#000!important;}</style>';
    }
}
add_action('login_head', 'custom_login_head');
add_filter('login_headerurl', create_function(false,"return get_bloginfo('url');"));
add_filter('login_headertitle', create_function(false,"return get_bloginfo('name');"));

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注