[wp-hackers] api.wordpress.org/themes ?
mikeschinkel at gmail.com
Mon Jan 12 07:50:35 GMT 2009
Looks like the API was coded with the plugins in mind and not the themes in
I've been working in similar areas recently albeit for plugins instead of
themes but what I've learned per those on this list is that the API was
designed more to meet the immediate needs for what was viewed as "internal"
functionality rather than architected with other use-cases in mind.
Anyway, I'm 99% sure you can get what you need short term by getting the
theme's slug using the API and then adding the slug to the end of this URL
to compose the URL for the HTML page for the theme:
>From there use file_get_contents() to grab the HTML and preg_match() to
extract the URL for the download file. Doing so violates several "best
practices" as per the W3C but it works and if for short term I'd say go for
it. It's basically what I'm doing for a related plugin.
Mon, Jan 12, 2009 at 2:13 AM, Jason DeVelvis <sales at emailappeal.com> wrote:
> I'm trying to code a themes installer plugin, similar to the plugin
> installer in the core (I know, I know, it'll probably be in 2.8, but I want
> it now...) and I've got it to do everything except find the proper theme
> .zip file.
> The API returns a download URL like
> http://downloads.wordpress.org/theme/openair.zip which returns a 404...
> actual extend download URL for openair is
> Any ideas why the API download URLs are invalid? Did I jump into the API
> early :) Could it be easily fixed so my plugin works? Or is there something
> else going on in my code if the API is returning the wrong d/l links?
> Here's the serialized api info for this call:
> Note, that api info is obtained with this line of code:
> $api = themes_api('theme_information', array('slug' => $theme, 'fields' =>
> array('sections' => false) ) ); //Save on a bit of bandwidth.
> (where $theme = the slug I retrieved earlier in the process, which is
> Coincidentally, there is no version # passed with the api call either.
> be the same problem?
> Any help would be tremendous!
More information about the wp-hackers