如需VPS代购、PHP开发、服务器运维等服务,请联系博主QQ:337003006
广大站长都非常关心自己网站的收录情况,尤其是国内最大的搜索引擎百度,每天用站长工具和site反复的查询,现在不用再忧愁啦!由网友第四维开发了一款wordpress插件baidu accept,可检测文章页面是否被百度收录。
插件功能:
判断当前文章是否被百度收录,若没有被收录则可点击提交至百度,加速收录!(此插件在文章页面仅管理员可见)
效果图:
如果不想使用插件的童鞋,可以使用如下代码实现此功能,复制下面的代码添加到当前主题的 functions.php 即可:
/* Plugin Name: Baidu-Accept Plugin URI: http://www.d4v.com.cn Description: 判断当前文章是否被百度收录,若没有被收录则可点击提交至百度,加速收录!(此插件在文章页面仅管理员可见) Version: 1.0 Author: Jovae Author URI: http://www.d4v.com.cn License: GPL */ function d4v($url){ $url='http://www.baidu.com/s?wd='.$url; $curl=curl_init(); curl_setopt($curl,CURLOPT_URL,$url); curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); $rs=curl_exec($curl); curl_close($curl); if(!strpos($rs,'没有找到')){ return 1; }else{ return 0; } } add_filter( 'the_content', 'baidu_submit' ); function baidu_submit( $content ) { if( is_single() && current_user_can( 'manage_options') ) if(d4v(get_permalink()) == 1) $content="百度已收录(仅管理员可见)
".$content; else $content="百度未收录!点击此处提交(仅管理员可见)
".$content; return $content; }
插件大小:1.39KB
插件地址:baidu-accept.zip
转载于:http://www.d4v.com.cn/web/1130.html