The first thing to do is to add the following function to your functions.php file:
function getTrimUrl($url) {
$tinyurl = file_get_contents("http://api.tr.im/api/trim_simple?url=".$url);
return $tinyurl;
}On your single.php file, paste the following within the loop:
<?php
$turl = getTrimUrl(get_permalink($post->ID));
echo 'Short Url for this post: <a href="'.$turl.'">'.$turl.'</a>'
?>
That’s all, enjoy tr.im urls!