Because of the restriction on character numbers in Twitter, you have to use a URL shortener when tweeting URLs. So, to help your readers tweet about your posts, you should definitely provide short URLs for all of your posts.
Here’s how to automate that task:
Open your functions.php file and paste the following code:
$tinyurl = file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
return $tinyurl;
}
Once done, paste this in your single.php file, within the loop:$turl = getTinyUrl(get_permalink($post->ID));
echo 'Tiny Url for this post: '.$turl.''
?>
To see this in action, visit WpVote, and look at any post.
Source: How to: Automatically provide TinyUrls for your WordPress blog posts
Thursday, May 21, 2009
How to : Automatically create TinyUrls for your blog posts
function getTinyUrl($url) {
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment