Question: How do I create a twitter icon/link that readers can use to promote my blog posts, scrunch up the URL of the blog post so it fits appropriately within the 140 character limitation of twitter, and send it to twitter when someone click on the icon/link?
Answer: Use a TweetMeme button plugin by installing the WordPress plugin.
Well, that’s one way. Another way is to use a couple WordPress plugins (assuming you’re using WordPress as your blog platform) to customize how you want to tweet blog posts to twitter.
The purpose of this article then is to show you how to shrink a URL using a URL shortener before sending it to twitter. If you don’t shrink a URL, it could very well go over the 140 characters per tweet limit.
What you’ll need:
- Browse over to the WordPress Plugin Directory and download the Simple Twitter Link plugin.
- While there, you’ll need to download the Simple URL Shortener plugin.
- Both plugin folders need to be uploaded to your wp-content/plugins folder.
- Make sure the settings for the cache folder under the Simple URL Shortener folder is set to 0777. You can do this using your FTP client software.
- Activate both plugins using the WordPress plugins screen.
Note: There are no options screen for these plugins. You’ll use them via code. Even though this example shows the use of the Simple Twitter Link plugin, that plugin calls the Simple URL Shortener.
Here’s the code:
<a href=”<?php simple_twitter_link(‘%bit.ly%Reading “%title%” – %url%’); ?”>Send to Twitter</a>
The above code is used in the Thesis Theme custom_functions.php file. It is something like the code I use for the twitter button at the end of this post.
There are other ways to use these two plugins. Check out the links above and discover how you can format them.
If everything is aligned after you install the plugins, then the above code should work for you.
However, if you’re using PHP in your blog posts, blog pages and text widgets, you’ll need to download and install one extra plugin called Exec-PHP. Exec-PHP allows you to run PHP syntax in your posts, pages and text widgets.
If you like this article, please try tweeting this blog post using the twitter button below to try out what this article is about. Also, if you’d like a couple ways I’m using twitter, please subscribe to my newsletter and you’ll receive that free right away.