Tweet-button for website
Yeah, completely in twitter-fever! Just developed a tweet-button.
You can see the button at the end of every post. The button itself of course isn’t my work, I just copied it from twitter, but when you click the link around it you can tweet the actual post directly to twitter! Feel free to try it! ;)
It’s more than easy. All the code you need is (replace […]):
<a href="http://twitter.com/share?url=[URL_TO_THIS_SITE]&lang=[en|de|..]&via=[NAME_OF_YOUR_TWITTER_ACCOUNT_FOR_@_LINK]&text=[TEXT_FOR_TWITTERMSG]" >
Tweet it <img src="[TWITTER_IMAGE]"/>
</a>
So the code that I wrote in my theme is:
if ( is_singular() )
{
$tweet = '<span id="tweetit"><a href="http://twitter.com/share?url=https%3A%2F%2F'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"].'&lang=en&via=binfalse&text='.the_title('', '', false).'" >
<span id="tweetittext">Tweet it</span>
<img src="/wp-content/uploads/2010/08/btn_tweet_mini.png"/>
</a></span>';
$tweet .= "<br />";
}
After that just using the $tweet
variable at any position I like ;)
Leave a comment
There are multiple options to leave a comment: