
Now if you want to make it easy for your site visitors to share links of your blog articles on Twitter, follow the instructions below - you don't need any plug-ins and the post URLs are automatically shortened in the tweet via bit.ly (a good alternative to tinyurl that also provides live traffic statistics).
Add Tweet This to your WordPress Theme
Step 1: Open the header.php file of WordPress and insert the following lines just before the closing </HEAD> tag.
<?php if ( is_single() ) { ?>
<script type="text/javascript" charset="utf-8"
src="http://bit.ly/javascript-api.js?version=latest&login=tweettrackjs&apiKey=R_7e9987b2fd13d7e4e881f9cbb168f523"></script>
<script type="text/javascript" charset="utf-8"
src="http://s.bit.ly/TweetAndTrack.js?v=1.01"></script>
<?php } ?>
Step 2: Open the single.php file and insert the following line just below the_content() function.
<a href="#" onclick="return TweetAndTrack.open(this, '<?php echo get_permalink();?>');">
<span style="display:none;">Reading: <?php the_title();?></span>Tweet This: Send Page to Twitter</a>
There's a similar service called TwitThis which is again easy to setup but it requires the Twitter password so some of your readers may not feel very comfortable doing that.
Add Twitter to Blogger Template
Go to your Blog Layout -> Edit HTML and click the box that says "Expand widget templates".
Take a backup of your Blogger template. Now search for the class "post-footer" in the Blogger XML template and copy-paste the following snippet somewhere near that class.
<b:if cond='data:blog.pageType == "item"'>
<script charset='utf-8' src='http://bit.ly/javascript-api.js?version=latest&login=tweettrackjs&apiKey=R_7e9987b2fd13d7e4e881f9cbb168f523' type='text/javascript'/>
<script charset='utf-8' src='http://s.bit.ly/TweetAndTrack.js?v=1.01' type='text/javascript'/>
<a expr:onclick='"return TweetAndTrack.open(this, \"" + data:post.url + "\");"' href='#'>
<span style='display:none;'>Reading: <data:post.title/></span>Post Link to Twitter</a>
</b:if>
That's it. If you want to replace the "Tweet This" link with a graphic of the Twitter bird, add an IMG tag instead of text. For more Twitter tricks, check the Twitter Guide.
0 comments:
Post a Comment