
Tweetmeme is a popular service that allow you to display “Retweet” button on your blog posts. Even if the code is easy to integrate on your single.php file, it can be very cool to create a shortcode that you can insert anywhere in your posts.

Tweetmeme is a popular service that allow you to display “Retweet” button on your blog posts. Even if the code is easy to integrate on your single.php file, it can be very cool to create a shortcode that you can insert anywhere in your posts.
Paste the following code in your functions.php file in order to create the shortcode:
function tweetmeme(){
return '<div class="tweetmeme"><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div>';
}
add_shortcode('tweet', 'tweetmeme');
Once done, you can display the Tweetmeme "retweet" button anywhere on your posts. In WordPress editor, make sure you are in HTML mode and insert the following:
[tweet]
When your post will be published, the shortcode will be replaced by the TweetMeme button.
17 Responses
Is there anyway to not have the reply have @tweetmeme in it?
Is this the same retweet button you are using?
I’ve been trying to find a solution that doesn’t require linkage to tweetmeme and only posts to twitter. Also would like the ability to customize the button.
Can be a problem if you already have the tweetmeme plugin. I had to rename the function tweetmymeme()
Thanks anyway.
Personally I would not encourage this method since you will have a lot of [tweet] in your posts when you finally decide to remove this plugin. Twitter will not be a success forever and then it might be a good idea to remove all plugin related to it.
Instead I would recommend people to add this plugin to their theme.
@Stefan
You and I know Twitter is a hot thing that’ll fade like the internets of old, but there are clients and social media marketers that would insist on this sort of functionality on each post. Personally, I prefer the “share” link, no need to double dip, but retweet is popular now.
@Branden Silva : yes it is the same, but mine is hardcoded in my theme. If you visit one of my other blogs, this is exactly that method that I implemented on there.
@Stefan : “I recommend using this plugin”…WpRecipes is, since its creation, a WORDPRESS HACKS sites. It have nothing to do with plugins.
How to include RT@myusername in when you use this plugin. Thank You.
@Rajesh : Have a look to http://help.tweetmeme.com/2009/04/06/tweetmeme-button/
hey how can I add this button to my theme to get the same result? probably adjacent to the title post the RT button will look quite observable to my readers.
Can a custom hastag be added to every tweet by modiying the core code of tweetmeme plugin?
Trackbacks: