How To Add Twitter Retweet Button To Blog Without Using Plugins

We discussed about how to add WordPress Facebook like button or the Facebook share button on your WordPress blog without using plugins. If you are a blog or website owner, then you can make use of the Twitter Retweet button and will help your readers to share the content on twitter thus making the blog post more popular.
Twitter is the most widely used micro blogging platform and is used by millions of people across the glob.
As we discussed, it is always a good idea to allow users or readers to your users to share your blog post. This can be any social media service like Facebook , Twitter, Digg , Stumbleupon , FriendFeed , Delicious etc.  to name a few. The more people share your post the more popular your blog and search engine gives more importance based on the number of external links to the post.
Today we will see how to add Twitter “Retweet” button to your website or blog (wordpress or nay other) post or any other pages without using any plugins. Twitter-Retweet-button-website-blog

Add Twitter “Retweet” Button scripts to your blog post .

The Twitter retweet code placement is based on the blog platform or website you use. Find the proper place in the pasge or post where you want to add the Twitter retweet button code.

How to add Twitter Retweet button to your wordpress blog post

In wordpress the file which will be rendered as the post page is the ‘single.php” file. This you can see in the themes folder. Once you identified the file, you can add the code given below to the location where you want the Retweet button to appear. Find the code similar to the below code. If you want to add the Retweet button below the title you can add similar to the below code.

1
2
3
4
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
...................................................................................
<?php the_title(); ?>
YOUR TWITTER RETWEET SCRIPT CODE HERE

If you want to add the “Like” button below the post content you can find code similar to the below and add the script.

1
2
3
4
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
...................................................................................
<?php the_content(); ?>
YOUR TWITTER RETWEET SCRIPT CODE HERE

Identify the appropriate location inside the loop, like after post header or at the end of the content etc.

The Twitter Retweet button code for websites and blogs

The retweet button code is a simple piece of JavaScript code which gives you up to date tweet counts and shorten your title and link for the retweets.
The script below displays the default retweet button (Large button). The button will automatically grab the URL of the page it is placed on. By default the retweet button will be in the format of “RT @tweetmeme <title> <link>”. You can change the source by adding the “tweetmeme_source “ option.

1
2
3
<script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js">
tweetmeme_source = 'globinch';
</script>

If you want to cuse ompact version of the TweetMeme button, you can use the following code.

1
2
3
4
5
<script type="text/javascript">
tweetmeme_style = 'compact';
tweetmeme_source = 'globinch';
</script>
<script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script>

Tweetmeme also allows you to use a URL shortener of your choice. To do this use the “tweetmeme_service” parameter. For example if you want to use “bit.ly” then trhe code will be similar to the below.

1
2
3
4
5
6
<script type="text/javascript">
tweetmeme_style = 'compact';
tweetmeme_source = 'globinch';
tweetmeme_service = 'bit.ly';
</script>
<script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script>

If your service require API key then you can add the “service_api” to include the API key.

Before you Go,

Before you go, subscribe to get latest technology articles right in your mailbox!.

One thought on “How To Add Twitter Retweet Button To Blog Without Using Plugins

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Shares