[theme-reviewers] Getting Theme Download Count

Jose Castaneda jomcastaneda at gmail.com
Tue Feb 11 21:23:35 UTC 2014


Neat! Thanks for sharing that tidbit Otto! *saved*


On Tue, Feb 11, 2014 at 12:39 AM, Otto <otto at ottodestruct.com> wrote:

> On Tue, Feb 11, 2014 at 2:34 AM, Otto <otto at ottodestruct.com> wrote:
>
>> On Mon, Feb 10, 2014 at 11:55 PM, Bryan Hadaway <bhadaway at gmail.com>wrote:
>>
>>> If we wanted to get and display the download count for one of our
>>> themes, would it be appropriate to...
>>>
>>
>> Define "download count". What number are you expecting, for what theme,
>> exactly?
>>
>> We have a number of assorted stats regarding download count, so it's hard
>> to say how to get it without more information about what number you want to
>> get. :)
>>
>> Don't scrape. There's probably an API request for the number you want.
>>
>
>
> If you just want the big number, I guess example code would help cut any
> sort of accidental "abuse" off at the pass...
>
>
> include_once ABSPATH . 'wp-admin/includes/theme.php';
> $api = themes_api( 'theme_information', array('slug' => 'twentythirteen',
> 'fields' => array( 'downloaded' => true ) ) );
> var_dump($api->downloaded);
>
> // result:
> // int(343090)
>
>
> I would recommend caching the resulting data somewhere instead of hitting
> the API every single time. Like, maybe a 24 hour transient or so?
>
> -Otto
>
>
>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20140211/79c5e7d9/attachment.html>


More information about the theme-reviewers mailing list