WordPress无pg麻将胡了全屏红中PPG电子赏金女王夺宝G插件外部链接自动添加nofollow标签
严格要求的话是需要在外部链接全部加上nofollow标签。有时内容会引用或分享一些外部链接地址,当然目前一些wordpress主题设置有这个nofollow标签功能。这样所有的外部链接就会自动加上nofollow标签。在技术层pg麻将胡了全屏红中PG面是有传递出去权重。PG电子赏金女王夺宝 在wordpress写文章时,
//文章自动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;}
添加到当前主题Funcions.php 文件中,当然我们也可以通过代码实现无插件添加方法。
-
上一篇
-
下一篇
- 最近发表
- 随机阅读
-
- 泰达股份拟出售扬州万运100%股权聚焦生态环保主业
- HTML5+three实现3D酷炫拼魔方游戏代码
- HTML5表单元input(二)
- dedecms织梦5.7仿站视频教程(中级上部)
- HTML5表单元input(二)
- wordpress提示function.call
- HTML网页植物大战僵尸源码分享
- JavaScript对象中的方法/如sort(参数)方法
- 卡通海底潜艇404页面动画特效
- css如何清除浮动clear与float
- wordpress网站隐藏内容付费阅读/下载插件foxpay
- 华为发布HUAWEI Pura 80系列 王者归位再次引领移动影像未来
- WordPress插件Ultimate Category Excluder排除分类文章
- WordPress添加QQ/微博登录Erphplogin插件
- DedeCMS个人网站常见漏洞有哪些
- WordPress响应式/音乐/个人博客杂志Always主题V1.8
- 织梦DedeCMS图集发布图片调用外链方法
- 大学生情人节520表白html源代码大全
- TON Defies Market Sentiment With a Massive 23% Surge, BTC Slumps Toward $70K (Market Watch)
- 织梦include\ckeditor\ckeditor
- 搜索
-
- 友情链接
-