1.在Wordpress下编辑functions.php文件在“?>”之前添加如下代码
//添加百度是否收录功能 function baidu_check($url, $post_id){ $baidu_record = get_post_meta($post_id,'baidu_record',true); if( $baidu_record != 1){ $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,'没有找到该URL。您可以直接访问') && !strpos($rs,'很抱歉,没有找到与') ){ update_post_meta($post_id, 'baidu_record', 1) || add_post_meta($post_id, 'baidu_record', 1, true); return 1; } else { return 0; } } else { return 1; } } function baidu_record() { global $wpdb; $post_id = ( null === $post_id ) ? get_the_ID() : $post_id; if(baidu_check(get_permalink($post_id), $post_id ) == 1) { echo '<a target="_blank" title="点击查看" rel="external nofollow" href="https://www.baidu.com/s?wd='.get_the_title().'">百度已收录</a>'; } else { echo '<a style="color:red;" rel="external nofollow" title="点击提交,谢谢您!" target="_blank" href="https://zhanzhang.baidu.com/sitesubmit/index?sitename='.get_permalink().'">百度未收录</a>'; } }
2.然后在需要在Wordpress显示的地方添加如下代码
<span class="item"><?php baidu_record(); ?></span>

关注公众号『窗外天空』
获取更多建站运营运维新知!互联网创业、前沿技术......
最新评论
同求这个型号的安装包
你好 路由器型号 gl ax1800 GL-AX1800 架构 ARMv7 arm_cortex-a7 armv7l Linux version 4.4.60 (glinet@glinet) (gcc version 5.5.0 (OpenWrt GCC 5.5.0 r16273+113-378769b555) )
大佬,你好 我有个mikrotik的RB450g cpu是AR7161 刷了官方的包也能用了。但是插架装不上去。能指导一下吗
用opkg install *.ipk安装后,提示如下,请问现在是成功了吗? 这个Not downgrading package 提示是什么意思呢,谢谢啦
麻烦您再请教下:X86的zip压缩包里面有很多ipk文件,是需要逐个安装吗。另外还有四个不同后缀的packages文件,这四个文件怎么处理呢!谢谢啦