The first thing to do is to open your functions.php file and insert the following function:
function tweetCount($url) {
$content = file_get_contents("http://api.tweetmeme.com/url_info?url=".$url);
$element = new SimpleXmlElement($content);
$retweets = $element->story->url_count;
if($retweets){
return $retweets;
} else {
return 0;
}
}
Once done, open your single.php file and paste the following:
$rt = tweetCount(get_permalink()); echo "Retweeted ".$rt." times.";
Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!
How to count retweets in full text on your WordPress posts