
When sharing urls on Twitter or other social bookmarking tools, you need short urls. The most common solution is to use an url shortener services. Even if this is a good idea, you can get short urls using only WordPress. How? Just read on.

When sharing urls on Twitter or other social bookmarking tools, you need short urls. The most common solution is to use an url shortener services. Even if this is a good idea, you can get short urls using only WordPress. How? Just read on.
This hack is very simple. Instead of using permalinks, let's use the post ID to get a shorter url.
Paste the following code on your single.php file:
<?php echo get_bloginfo('url')."/?p=".$post->ID; ?>
It will output an url of this form:
http://www.wprecipes.com/?p=54
And you're reading for twitter sharing!
Thanks to Aytemir for this great idea!
Leave a Comment