0
(0)

google被屏蔽,如果想搜索一些国外的信息,除了翻墙,其实还可以使用bing搜索。bing搜索界面一大亮点就是背景图片大气美观,并且会经常变动,本文讲到的是通过一小段代码同步调用bing的背景图片美化wordpress后台登录界面。

1、找到主题中的函数文件 functions.php;
2、在?>标签之前增加以下代码:
//调用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');

3、保存修改后效果如图:

2016-11-24_132339

声明:本站分享的WordPress主题/插件均遵循 GPLv2 许可协议(免费开源),相关介绍资料仅供学习参考,实际版本可能会因版本迭代或开发者调整而产生变化,如程序中涉及有第三方原创图像、设计模板、远程服务等内容,应获得作者授权后方可使用。本站不提供该程序/软件的产品授权与技术服务,亦不收取相关费用。