WordPress.org Theme API Updates

In my last post I mentioned how changes to the Theme APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. that are necessary for the new Theme Directory, are done. It turned out that it’s only half true. Since the API is just as much based on bbpressbbPress Free, open source software built on top of WordPress for easily creating forums on sites. https://bbpress.org. as the current Theme Directory is, the underlying data source for it has to be changed as well, to use the new WordPress site that is being built. All of these changes will not affect the output of the API however, so let me go over the few things that we added recently, and that might be interesting for developers using the API.

The first step was a whitespace clean up, a chance to bring the code up to date with current WordPress coding standards, to make it easier to grok future changes to the file. After that, two fields were added for theme responses, ratings and parent. Those fields are not included by default, so they have to be explicitly added to any request.

If ratings are requested, it adds an array with the number of reviews for each rating level. For Twenty Ten, it looks like this:

  public 'ratings' => 
    array (size=5)
      1 => int 7
      2 => int 0
      3 => int 9
      4 => int 31
      5 => int 88

The Theme Directory uses that information to generate the broken down rating statistics.

To be able to display decently rich information about a theme’s parent theme, the parent parameter was added. It will add an array with some information about the parent theme. Currently it has three rows, but if the need ever arises to add more information there, it’s possible to extend it to a full theme object without sacrificing backwards compatibility. For 2013 Green it looks like this:

  public 'parent' => 
    array (size=3)
      'slug' => string 'twentythirteen'
      'name' => string 'Twenty Thirteen'
      'homepage' => string 'https://wordpress.org/themes/twentythirteen'

For an example of all fields for a theme, you can use this poetic piece of code:

include ABSPATH . 'wp-admin/includes/theme.php';
$theme = themes_api( 'theme_information', array(
   'slug'   => 'twentyten',
   'fields' => array(
      'description'    => true,
      'sections'       => true,
      'rating'         => true,
      'ratings'        => true,
      'downloaded'     => true,
      'downloadlink'   => true,
      'last_updated'   => true,
      'tags'           => true,
      'template'       => true,
      'parent'         => true,
      'versions'       => true,
      'screenshot_url' => true,
   ),
) );

var_dump( $theme );exit;

#theme-directory, #themes-api

Theme Directory Update 1/9

After some slow-down over the holidays, the main parts of the new Theme Directory finally made their way onto wordpress.orgWordPress.org The community site where WordPress code is created and shared by the users. This is where you can download the source code for WordPress core, plugins and themes as well as the central location for community conversations and organization. https://wordpress.org/ this week. Since the last update I worked mostly on the functionality side, rewriting the theme uploader and creating a small workflow to approve and suspend themes from `wp-admin`.

Both the theme and the plugin that make up the new Directory are open sourceOpen Source Open Source denotes software for which the original source code is made freely available and may be redistributed and modified. Open Source **must be** delivered via a licensing model, see GPL., and can be contributed to on meta.trac.

There are still a few things to figure out before we can start working on the launch:

  • Fix some annoying JS bugs around display themes on first load r1119-meta.
  • Make synchronizing theme review results a cron job.
  • Make sure uploaded theme files are always deleted, no matter the outcome.
  • Rewrite the Theme APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. and downloads handling to work with WordPress.
  • Import existing themes from bbpressbbPress Free, open source software built on top of WordPress for easily creating forums on sites. https://bbpress.org..
  • Make the theme and pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party available for translations.
  • Test localized versions.
  • Add navigational links to Upload and Commercial page to global headerHeader The header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes..
  • Actually making the switch.

Big items that already work:

  • All necessary API changes are in.
  • The upload process(!).
  • Theme suspension and approval.
  • Theme version handling.
  • Theme index (a little buggy for now, scroll down to reveal the themes).
  • Commercial theme page.

You can read up on the entire project process in #745-metaMeta Meta is a term that refers to the inside workings of a group. For us, this is the team that works on internal WordPress sites like WordCamp Central and Make WordPress..

#theme-directory

Quick status update for the Theme Repository Theme…

Quick status update for the Theme Repository Theme:
I’ve moved over almost all of the information that we want to keep from the current single-theme-view. The single view now also looks more or less like the modal and is en par with it information-wise as well. Fixed a few bugs surrounding keyboard navigation in the theme preview, tag linking. Yesterday I also started with some APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. changes necessary to get more metaMeta Meta is a term that refers to the inside workings of a group. For us, this is the team that works on internal WordPress sites like WordCamp Central and Make WordPress. information that it was necessary in the WP admin. Jan Cavan Boulas will help me with some design work around the single-theme-view.

Next up are more API changes, responsive styles (and styles in general), as well as tag filtering improvements.

#theme-directory

Theme Repository Theme

A while back, @otto42 started to work on bringing the Theme Directory over to WordPress (I know that sounds weird, but currently it runs on an old version of bbpressbbPress Free, open source software built on top of WordPress for easily creating forums on sites. https://bbpress.org.). The idea is to split functionality and appearance, making the Repopackage custom post typeCustom Post Type WordPress can hold and display many different types of content. A single item of such a content is generally called a post, although post is also a specific post type. Custom Post Types gives your site the ability to have templated posts, to simplify the concept. and the uploader a pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party, and let a theme handle the display of themes.

With the help of Matias Ventura, I continued Otto’s work on the theme part of things, taking the existing theme install experience from the admin and making it work on the front-end of the theme. I’m currently in the process of adding server output, so the repository stays crawl-able for search engines. Steps to take going forward include determining what features to take over from the existing theme repository (as the theme install UIUI UI is an acronym for User Interface - the layout of the page the user interacts with. Think ‘how are they doing that’ and less about what they are doing. is a lot simpler), adding these things to the APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways., and figuring out how single theme views should look like vs. detail views on index.
I haven’t committed any improvements to meta.tracTrac Trac is the place where contributors create issues for bugs or feature requests much like GitHub.https://core.trac.wordpress.org/. so far as they are dependent on #30116, but the plan is to make that process a little bit more public. Once the coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. improvements are in, I’ll make sure to push my updates. Everything will be trac’ed in #745-meta so you can follow along there.

Yesterday @coffee2code and I chatted about how we can work together on the project as well. He’ll look at the difference between the current theme repository and the in-dash experience, to determine what to keep and what to drop. Scott might also be able to pitch in on the plugin side at a later point in time, where we still need to make the theme uploader work.

We’d like to have the new experience ready to go before the end of the year. For that to happen we might decide to take a more iterative approach, go with what the in-dash experience has to offer right now, and do a v2 where we port back features from the existing theme repository. This part has not been determined so far.

#theme-directory

Theme directory listing multiple authors the way plugin…

Theme directory, listing multiple authors the way pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party directory does. Remind me why that wasn’t possible last time we discussed it?

#theme-directory