在控制台不设置页面背景,这样的话显示的就是我们的bing美图啦,同样,也不影响自己设置的背景,如果自己设置的话,bing的壁纸就会被覆盖掉
- function bing_auto_bg()
- {
- $str=file_get_contents('http://global.bing.com/HPImageArchive.aspx?idx=0&n=1');
- if(preg_match("/<url>(.+?)<\/url>/ies",$str,$matches))
- {
- $imgurl='http://global.bing.com'.$matches[1];
- echo'<style type="text/css">body{background: url('.$imgurl.');width: 100%; height: 100%; -moz-background-size: cover;-webkit-background-size: cover;background-size: cover; background-position: top center; background-attachment: fixed; }</style>';
- }
- }
- add_action( 'wp_head', 'bing_auto_bg' );
2017年10月14日 下午5:06 沙发
改的是哪个文件?求回复
2017年10月30日 上午11:54 1层
@风一样的男子 主题下的functions.php文件