I Am One Man

Web designer & developer residing in Rochester, England with an RSS Feed

WordPress Short Links #

This is a super quick and (i think) the best way to add short links to your WordPress powered blog.

<a href="<?php bloginfo('url'); ?>?p=<?php echo $post->ID; ?>"><small>#</small></a>

Explained

All this does is gets your blogs URL and adds the posts ID after the ?p= bit. WordPress can tell if you have pretty URLs and will redirect you there before the page even loads, as it’s all server side. The main benefit would be that it keeps your domain name in the link, and therefore part of your branding. It does have to go in the loop though.

So for this post, the following gets put into the page.

<a href="http://iamoneman.com?p=430"><small>#</small></a>

Perfect!

Leave a Reply

Please leave a comment, let me know what you're thinking. If your comment isn't shit, I'll reply too! ;)