Few hours ago, @twitter has officially released their brand new tweet button for content publishers to share their content through twitter. @TweetMeme has Retweet button integration with a number of blogging platform which was also used previously in this website. Now codereflect.com is integrated with brand new tweet button to share the content.
Twitter supports 3 different kind of buttons so far which contains a tweet button and also a retweet count linked to a twitter search page, which can display the reteweets on this same URL.
The steps for creating the reteweet button is quite easy. With simple 3 steps your retweet button will be ready.
Head to http://twitter.com/tweetbutton
Choose your button type
The biggest advantage of twitter share option is, you can add a set of twitter account suggest to follow.
You’re done.
Now You’ve created a typical button for your website. But now let’s see how to integrate this to wordpress. The default tweet button can’t work with the dynamic post contents in the blog. But it has options to specify the felids to control all parameters associated with the tweet button and share window eventually appears on clicking it.
Head to Developer page to get more information about tweet button http://dev.twitter.com/pages/tweet_button
Here I’m talking about the javascript version of the tweet button. The parameters which can be passed to script are listed below
|
Data Source |
Share query string |
data- attribute of anchor tag |
rel= attribute of a link tag |
Default |
|
Priority |
1 |
2 |
3 |
4 |
|
URL to Tweet |
url |
data-url |
rel="canonical" |
HTTP Referrer |
|
via user |
via |
data-via |
rel="me" |
|
|
Tweet text |
text |
data-text |
Content of the <title> tag |
|
|
Recommended accounts |
related |
data-related |
||
|
Count box position |
count |
data-count |
horizontal |
|
|
Language |
lang |
data-lang |
en |
In addition to the default button HTML code generated, we may have to add some more parameters to enable it in wordpress hosted blog
Modify Index.php from Appearance->Editor option
Copy the generated HTML code between the iteration to display the post. The screenshot is attached above. You may have to add data-url and data-text parameter to enable tweet button specfically for each post in the blog post. You can simply call the php call to get the title and and link the URL
Modify the Singlepost.php from Apperance->Editor Menu
This is also done in the same fashion for PHP.
Finally the share window appear as follows.
I’m not covered all the parameters listed for the tweet option. Please check the documentation it’s simple as it’s. There may be a better way for doing these things. I’m not an expert web programmer. Please share if you’ve any comments. Hope you enjoy this