Using tr.im with Twitter Tools in Wordpress
For integrating my Twitter account with Wordpress, I’m using the Twitter Tools plugin by Crowd Favourite. This includes a “plugin plugin” for shortening blog URLs with bit.ly. I prefer tr.im as URL shortener, so I was looking for a solution to use tr.im instead of bit.ly.
There is a tr.im “plugin plugin” for Twitter Tools by John Girvin, but this did not work for me, don’t know why.
So I did it by editing the Twitter Tools original bit.ly Plugin:
- Open twitter-tools-bitly.php in your Wordpress plugin editor
- Find the function aktt_bitly_shorten_url() and comment it out (or delete it, if you are sure)
- Replace it by this function:
function aktt_bitly_shorten_url($url) {
$parts = parse_url($url);
if (!in_array($parts['host'], array(‘j.mp’, ‘bit.ly’, ‘tr.im’, ‘u.nu’, ‘is.gd’, ’sn.im’, ‘tinyurl.com’))) {
$short = file_get_contents(‘http://api.tr.im/api/trim_simple?url=’ . urlencode($url));
$sparts = @parse_url($short);
if ($sparts['host'] == ‘tr.im’) $url = $short;
}
return $url;
}
- Activate the Twitter Tools bit.ly Plugin
- Enter any bit.ly API account information in the Twitter Tools configuration (don’t know whether that’s necessary, I just entered a ‘0′ in all fields)
- Enjoy
- Twitter (4)
Tags (1)- Technisches (9)
Themen (1)
1 Antwort
1 Response to “Using tr.im with Twitter Tools in Wordpress”
[...] from: Using tr.im with Twitter Tools in Wordpress bei Dennis Jlussi AKPC_IDS += "1342,";Popularity: unranked [?] « The Benefits of Advertising – Business [...]