WordPr壹号娱乐ess无幸运赛车投注插件外部链接自动添加nofollow标签
当然目前一些wordpress主题设置有这个nofollow标签功能。当然我们也可以通过代码实现无插件添加方法。可以直接找一些wordpress插件安装。有时内容会引用或分享一些外部链接地址,这样所有的外部幸运赛车投注壹号娱乐rong>链接就会自动加上nofollow标签。 在wordpress写文章时,严格要求的话是需要在外部链接全部加上nofollow标签。如果手动每个链接加入是很麻烦, 添加到当前主题Funcions.php 文件中,//文章自动nofollowadd_filter( 'the_content', 'tin_seo_wl');function tin_seo_壹号娱乐wl( $content ) { $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>"; if(preg幸运赛车投注_match_all("/$regexp/siU", $content, $matches, PREG_SET_ORDER)) { if( !empty($matches) ) { $srcUrl = get_option('siteurl'); for ($i=0; $i < count($matches); $i++) { $tag = $matches[$i][0]; $tag2 = $matches[$i][0]; $url = $matches[$i][0]; $noFollow = ''; $pattern = '/target\s*=\s*"\s*_blank\s*"/'; preg_match($pattern, $tag2, $match, PREG_OFFSET_CAPTURE); if( count($match) < 1 ) $noFollow .= ' target="_blank" '; $pattern = '/rel\s*=\s*"\s*[n|d]ofollow\s*"/'; preg_match($pattern, $tag2, $match, PREG_OFFSET_CAPTURE); if( count($match) < 1 ) $noFollow .= ' rel="nofollow" '; $pos = strpos($url,$srcUrl); if ($pos === false) { $tag = rtrim ($tag,'>'); $tag .= $noFollow.'>'; $content = str_replace($tag2,$tag,$content); } } } } $content = str_replace(']]>', ']]>', $content); return $content;}
- 最近发表
- 随机阅读
-
- 个人网站/公司logo标志免费在线制作
- 网站域名要不要申请使用SSL证书(https)
- wordpress简洁单栏个人博客模板
- dedecms织梦仿站工具软件下载
- 个人网站分类目录内容管理系统源码下载
- 阿里云虚拟主机:网站木马查杀与数据自动备份
- dreamweaver cs6中文版下载安装
- 搜索引擎的工作原理(一)
- wordpress未能与站点联系致命错误,PHP修改被回滚
- dreamweaver cs6中文版下载安装
- 电脑本地搭建dedecms/帝国cms个人网站教程
- 帝国CMS个人网站地图sitemap.xml生成(插件)
- 5月30日,全新雷神Aura AI智能拍摄眼镜预约开启,颠覆你的摄影体验!
- HTML5实现人工智能中国象棋网页小游戏
- 影响爬虫抓取网页的因素
- SEO如何分析一个网站
- 阿里云虚拟主机:网站木马查杀与数据自动备份
- 爱奇艺qsv/腾讯视频qlv/优酷视频kux格式转换MP4
- HTML5表单元form(一)
- JavaScript语法构成/关键字保留字及变量
- 搜索
-
- 友情链接
-