Skip to content

Instantly share code, notes, and snippets.

@pdewouters
Created January 26, 2012 03:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pdewouters/1680885 to your computer and use it in GitHub Desktop.
Save pdewouters/1680885 to your computer and use it in GitHub Desktop.
display plugin download count from wordpress.org repository
function wpc_get_plugin_dl_count(){
$payload = array(
'action' => 'plugin_information',
'request' => serialize(
(object)array(
'slug' => 'pinterest-rss-widget',
'fields' => array('description' => true)
)
)
);
$body = wp_remote_post( 'http://api.wordpress.org/plugins/info/1.0/', array( 'body' => $payload) );
$downloaded = unserialize($body['body'])->downloaded;
print 'Plugin downloaded ' .$downloaded . ' times.';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment