跳转样式
go跳转设置了5秒缓冲时间,效果如下
测试链接
测试链接
首先在网站根目录创建一个名字为 go 的文件夹,并在该文件夹中创建 index.php 文件。
将下面的代码放在 WordPress 主题文件夹的 functions.php 文件内即可。
<span style="font-size: 10pt;">function the_content_nofollow($content){ preg_match_all('/<a(.*?)href="(.*?)"(.*?)>/',$content,$matches); if($matches){ foreach($matches[2] as $val){ if(strpos($val,'://')!==false && strpos($val,home_url())===false && !preg_match('/\.(jpg|jepg|png|ico|bmp|gif|tiff)/i',$val)){ $content=str_replace("href=\"$val\"", "href=\"".home_url()."/go/?url=$val\" ",$content); } } } return $content; } add_filter('the_content','the_content_nofollow',999);</span>