Add Tweet Box To Your Blog

Tweet Box allows Twitter users to tweet directly from your website or your blog. To add Tweet Box to your website or blog, simply add this little piece of code to your WordPress single.php theme file. You can place it anywhere you like. I have it installed at the bottom of this single.php page. See below.

<div id="tbox"></div>
<script type="text/javascript">
  twttr.anywhere(function (T) {
    T("#tbox").tweetBox();
  });
</script>

You can modify Tweet Box by passing parameters to the script.

<div id="tweet-box"><h3>Twitter</h3></div>
<script type="text/javascript">
    twttr.anywhere(function (T) {
      T("#tweet-box").tweetBox({
        'counter' : true,
        'height'  : 50,
        'width'   : 440,
        'label'   : "I made it easier for you to tweet this:",
        'defaultContent' : "Just read: <?php the_title(); ?>
        @ulyssesonline",
      });
    });
</script>

In this example, I’m displaying the counter, which counts the number of characters left in the tweet box. You can set the height and the width of the Tweet Box. I have it set to 440px x 50px to match the content area of my blog. I’m also displaying the label, as well as the default content. The default content includes the title of the blog. I’m calling the WordPress’s the_title() function to display the post title.

I hope you find this helpful. Send a tweet.