Display your number of tweets in full text mode on your WordPress blog

Twitter is obviously a very useful tools for bloggers. Did you ever wanted to know how many times your posts are sent to Twitter by your readers? If yes, just read on and learn how to know it, and display it on your blog, in full text mode.

paste the following function in your functions.php file:

<?php

function tweetscount ($url){

$content = file_get_contents(“http://api.tweetmeme.com/url_info?url=”.$url);

$x = new SimpleXmlElement($content);

$tweets = $x->story->url_count;

echo “Tweets: “.$tweets;

}

Once done, you can get the number of tweets for any web page you want, for exemple:

<?php tweetscount(“http://www.glanceworld.com”); ?>

To automatically display how many times your posts has been tweet, open the single.php file file and paste the following code:

<?php tweetscount($post->permalink); ?>

2 Responses to Display your number of tweets in full text mode on your WordPress blog

  1. GarykPatton June 16, 2009 at 9:02 am #

    I think I will try to recommend this post to my friends and family, cuz it’s really helpful.

  2. Cameron Bodin July 26, 2011 at 6:44 am #

    Great post. I need to thank you for this informative read, I actually appreciate sharing this great post. Keep up your work.

Leave a Reply

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