WordPress, Tweet Buttonを使ってみた

TwitterがTweet Button を公開しています。
http://twitter.com/goodies/tweetbutton

tweet button

簡単にTweet Buttonが追加できるようなので早速WordPressサイトで the_contentadd_filter しました。

functions.php

function inazuma_content_after_tweetbutton ($content) {
	global $post;
	$tweet_button = '';
 
	if (is_single())
		$tweet_button = '<div class="alignleft post-tweet"><a href="http://twitter.com/share" class="twitter-share-button" data-count="vertical" data-via="YOUR TWITTWER ID">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>';
 
	$content .= $tweet_button;
	return $content;
}
 
add_filter('the_content', 'inazuma_content_after_tweetbutton');

div class はお好みで。
plugin にしても良いかもです。
その内誰かが作ってくれるでしょう。

update
一覧画面でTweet Buttonを押すとその画面に表示されているカウンタが全てカウントアップされるようなので(?)singleの時だけ表示するようにコードを変更しました。

ページでも表示させるなら判定条件に is_page() を加えるとよいでしょう。

update
新しい Twitter「Tweet」ボタン
http://ja.blog.wordpress.com/2010/08/13/new-tweet-button/

WordPress.comでは早速機能追加されてますね。
プラグインもすぐに出るでしょう。