如何让twitter tools for wordpress推送tinyurl

twitter tools这个plugin不少人在用吧,有新的post时候自动发tweet这个功能很赞,但是默认情况下twitter tools发出的链接是原始链接,而不是tinyurl,这个功能可以通过如下方法实现:

在theme的functions.php的开头增加以下代码:

//start tinyurl for tweet
add_filter(‘tweet_blog_post_url’, ‘makeShortURL’);
if (!function_exists(’makeShortURL’)) {
function makeShortURL($URLToConvert) {
$shortURL= file_get_contents(“http://tinyurl.com/api-create.php?url=” . $URLToConvert);
return $shortURL;
}
}
//ends tinyurl for tweet

演示:http://google.org.cn @guao

via 12

This entry was posted in 电脑相关 and tagged , , , , . Bookmark the permalink.

10 Responses to 如何让twitter tools for wordpress推送tinyurl

  1. gkp says:

    懒得弄code plugin,需要的copy过去自己format吧

  2. raynix says:

    加个友情链接吧,我才想起来。已经加你了。

  3. gkp says:

    哈,我也一直没想起来这个事情,晚上加你的

  4. bolo says:

    很强大。博主的博客模板优化得很好!

  5. gkp says:

    @bolo,谢谢,欢迎常来。

  6. raynix says:

    我也弄上Twitter Tools了:)

  7. MathChief says:

    1111
    2222
    3333

    44444

    5555555

  8. gkp says:

    @MathChief,看到了?嘿嘿,我上午在调bit.ly的输出

  9. elion says:

    问一下,同样是用Twitter tools,为什么我的现在不能更新了,只停留在2星期以前。开始我以为被墙了,很正常。
    但其他好多人的却可以更新,比如你的博客上。也能正常更新的?

  10. gkp says:

    那个,我服务器在国外。。。

Leave a Reply

Your email address will not be published.