本文最后更新于 962 天前,文中的信息可能已经有所变化。如有误,请留言反馈。
必应美图,每天一张,不出家门看遍世界,感受大自然的魅力。
那么如何将必应美图设置为登陆界面的背景?
将以下代码加入当前主题的functions.php文件当中:
//调用bing美图作为登录页背景图 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.');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;}</style>'; }} add_action('login_head', 'custom_login_head');