Hello,嗨,大家好,我是哈喽猿。
这里是哈喽猿网
今天推送的是wordpress教程的文章,感谢您宝贵的时间阅读
WordPress SEO优化目录:
13.WordPress 新窗口打开文章/站外链接-添加nofollow属性
17.WordPress 网站压缩,批量调整上传图片的最大宽高
网站的搜索引擎是最关心网站管理员的情况,尤其是国内的搜索引擎巨头百度,但我不知道百度准确地收录在这个网站上,站长可能会很恼火。为此,专门开发了一个检查百度收录了百度文章页面的WordPress插件:白杜克,它可以判断当前文章是否被百度收录,如果没有收录,你可以点击提交到百度,加快收集速度!(这个插件-只有管理员在文章页面上才能看到)。
插件大小:1.39KB
链接:https://pan.baidu.com/s/1TTc9yob1gZf8LpO77ESp2Q
提取码:csmd
注:插件启用后,百度包含文章内容右上角的情况。部分代码来自网络,不喜欢下线。插件需要打开PHP的cURL扩展,否则就不能正常工作。
如果不想安装插件,请将以下代码直接添加到当前主题的functions.php中:
/*
Plugin Name: Baidu-Accept
Plugin URI: http://www.helloyuan.com.cn
Description: 判断当前文章是否被百度收录,若没有被收录则可点击提交至百度,加速收录!(此插件在文章页面仅管理员可见)
Version: 1.0
Author: Jovae
Author URI: http://www.helloyuan.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="<p align=right>百度已收录(仅管理员可见)</p>".$content;
else
$content="<p align=right><b><a style=color:red target=_blank href=http://zhanzhang.baidu.com/sitesubmit/index?sitename=".get_permalink().">百度未收录!点击此处提交</a></b>(仅管理员可见)</p>".$content;
return $content;
}
0 评论