Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
// Add our current post's URL to the end of Twitter's API URL
$twitter_url = file_get_contents( 'http://urls.api.twitter.com/1/urls/count.json?url=' . $url );
// Decode the URL in json
$twitter_shares = json_decode( $twitter_url, true );
// Set our variable
$tweet_count = $twitter_shares['count'];
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment