虽然WordPress已经发展到Version 2.5.1,但是我认为WP仍然缺少一个我们需要的一个十分常用而又简单的功能:自动链接辨认[Auto-Link]。很多朋友喜欢在博客里面添加很多链接,但是烦于不停的给URL路径加上链接,WP里面也暂时没有这方面的设置。我们可以自己手动做个简单修改达到这个功能:
在wp-includes目录里面找到post-template.php这个文件:
打开编辑,找到 function get_the_content()这个函数
在它的最后面作如下修改:
[code lang="php"]return $output;[/code]
增加为
[code lang="php"]$pattern = "/[\s]http:\/\/([^\s\"]+)/ism";
$replacement = " http://$1";
$output=preg_replace($pattern, $replacement, $output);
return $output;[/code]
« YUM介绍
« YUM介绍
2 Responses to “给WordPress加上自动链接辨认[Auto-Link]功能”
Leave a Reply
Related Posts
- 把博客服务器换成Nginx
- pubsubhubbub发布没有链接的问题
- WordPress3升级导致博客scheduled maintenance
- 终于把Blogger的日志导入WordPress
- Ucenter的外链漏洞?
你能详细说明白一点么?
….我加上去了,怎么样才有效果?是用文章的标题做tag么?
tag? 这里和tag没关系哦 e_e