wordpress给外部链接加上跳转 代码篇,直接将该代码插入到主题目录里functions.php 文件内即可,包爽,呵呵大!!!
-
- function git_go_url($content){
- preg_match_all('/<a(.*?)href="(.*?)"(.*?)>/',$content,$matches);
- if($matches && !is_page('about')){
- foreach($matches[2] as $val){
- if(strpos($val,':
- if(git_get_option('git_pagehtml_b')) {
- $content=str_replace("href=\"$val\"", "href=\"".home_url()."/go.html/?url=$val\" ",$content);
- }else{
- $content=str_replace("href=\"$val\"", "href=\"".home_url()."/go/?url=$val\" ",$content);
- }
- }
- }
- }
- return $content;
- }