Everyone wants the shortest links possible, mostly thanks to Twitter. There are a number of tutorials on creating your own link shortening service, and for WordPress sites, the Link Shortcut plugin is the most popular option.
You don’t need it.
If your domain (including the http) is under 24 characters or so, you can use the default permalink format. It works even if you’re using another permalink structure.
Just add this to your theme file and you’re done:
<p>Sharing this post? The short URL is <?php $url=get_bloginfo('url').'/?p='.$post->ID; echo '<a href="'.$url.'">'.$url.'</a>'; ?></p>
If your domain is too long, then hosting your own link service isn’t going to help. Twitter shortens URLs longer than 30 characters. You need to set aside 6 to 8 characters for the post ID (“/?p=123”), depending on how many posts you have. If your domain alone is longer than 22 to 24 characters, your shortened links will be too long for Twitter anyway — and it’s unlikely that a shortener plugin will get it much shorter than that. You can register a shorter alternate domain, or you can resign yourself to incoming links from third party shortening services.
Michel says
Good idea! And will work easily on most WP-based websites:)
Thank you for sharing!
(And maybe WP themes nowadays should have something like this built-in…)