To apply this hack, you have to make sure that the SimpleXML PHP extension is loaded. If you're using WpWebHost or HostGator, it is.
The first step is to place the following piece of code in your functions.php file:
function tweetCount($url) {
$content = file_get_contents("http://api.tweetmeme.com/url_info?url=".$url);
$element = new SimpleXmlElement($content);
$tweets = $element->story->url_count;
echo $tweets." tweets!";
}
Once done, open your single.php file and call the function like this:
<?php tweetCount($post->permalink); ?>
No comments:
Post a Comment