Developer Plugin 1.2.2 Released: New WP-CLI Command

Version 1.2.2 of the Developer plugin was recently released. The big feature of this release is a new WP-CLI command. If you’re not familiar with WP-CLI, it is “a set of command-line tools for managing WordPress installations.” These command-line tools let you do anything from download and install WordPress to manage options for your site. The command we’ve introduced will let you install and, optionally, activate the recommended plugins.

For example, the following will install and activate the Developer plugin and all the recommended plugins for WordPress.com VIP.

wp plugin install developer --activate
wp developer install-plugins --type=wpcom-vip --activate

As always, pull requests are welcome on Github. If you want to introduce a new WP-CLI subcommand or just stay up to date with the latest on the Developer plugin, join us there.

Developer plugin 1.2 released: UI Improvements and New Plugins

Version 1.2 of the Developer plugin is hot off the press!

1.2 includes a host of UI improvements as well as two new plugins, Log Viewer by Markus Fischbacher, and Jetpack by Automattic, plus a new Jetpack constant,  JETPACK_DEV_DEBUG. This release aims to improve the usability of Developer by adding:

  • Detailed messages in case of an error while installing or activating a plugin
  • Plugin descriptions on installation steps, so it’s more clear what you’re installing actually does
  • A link to the plugin details page on installation steps
  • A more obvious button to close the post-install modal window

Also included are some behind the scenes improvements to make recommended plugins and constants more flexible down the road as we continue to add to the plugin.

If you’d like to stay up to date with the latest on Developer, please join us on Github where all feedback, plugin suggestions, bug reports, and pull requests are always welcome!

Developer plugin v1.1: Themers are developers too!

UPDATE: we regularly push updates to the developer plugin, make sure you grab the latest version here: https://github.com/Automattic/developer.

We’ve pushed out v1.1 of the Developer plugin, which is packed full of goodies for WordPress theme developers.

You can now indicate that you’re working on a theme for a self-hosted WordPress install to get recommendations on a number of must-have plugins as suggested by the WordPress.com Theme Team.

We also cleaned up a few things, fixed some bugs, added some new plugins (User Switching by John Blackbourn and Pig Latin by Nikolay Bachiyski) and some other useful resources (like the _s starter theme).

(Note: we also pushed out v1.1.1 shortly after to fix an issue with the plugin slug for the Pig Latin plugin. Thanks bobbingwide for the fix.)

As always, if you’d like to check out the code and contribute, join us on Github; pull requests, bug reports, and plugin recommendations are more than welcome.

New P2 Plugin: P2 Hovercards

We’ve released a new plugin for the P2 theme that we’re calling P2 Hovercards. Hovercards are like extra bits of information about particular links that show up when you hover the corresponding inline link or object (for example, check out our Gravatar Hovercards).

With this plugin you can add hovercards to your self-hosted P2 sites. A good example of this is core trac tickets. If you look at the Make WordPress Core blog, you’ll notice that tagged Core Trac tickets are automatically linked up. So, something like #12345 links to http://core.trac.wordpress.org/ticket/12345.

With P2 Hovercards, we took this a step further. I can set it so that #12345 links to the right place, but then also show some additional information when you hover over the link. The following image is an example of what a hovercard could look like for that ticket:

You’ll notice that it gives all the necessary details about the ticket: description, recent comments, and related metadata like owner, status, and so on.

You can extend hovercards, of course, and use them for whatever service you want with a bit of code. Internally, we’re using the plugin to add details to links to support tickets, for example.

The plugin comes with a handy p2_hovercards_add_services() function for adding services:

if (function_exists( 'p2_hovercards_add_service' )
	p2_hovercards_add_service( $service, $pattern, $url, $ticket, $callback );

(Note: We recommend creating a child theme of P2 and adding the additional code to your functions.php file.)

Here’s a quick breakdown of the arguments:

  • $service is a string that is the name or slug of the service being added.
  • $pattern is a string that is the regex pattern for finding and linking up tags. For our Core Trac ticket example, you would use $pattern = '#(\d+)'
  • $url is a string that contains the regex replacement for the anchor tag that gets generated. Again, for the core trac ticket example, you would use $url = '<a href="http://core.trac.wordpress.org/ticket/$1">$0</a>'
  • $ticket is a string that contains the regex replacement for a ticket. Following the same example, you would use $ticket = '$1'
  • $callback is a callback function for generating the hovercard

The most basic callback looks something like this:

function core_trac_callback( $args ) {
	$id = (int) $args[ 'id' ];
	$url = esc_url( $args[ 'url' ] );
	$service = esc_attr( $args[ 'service' ] );

	// Do stuff with $id, $service, and $url

	return compact( 'title', 'subtitle', 'url', 'description', 'comments', 'meta' );
}

The first four things in the array ($title$subtitle$url, and $description) are just strings that will be displayed in the appropriate place on the card. The last two are a little more customizable depending what you want to do though.

Comments are stored in a 2-dimensional array with author, date, and comment fields. Meta is displayed as “Key: Value” in the black bar at the bottom of the hovercard.

More in-depth examples can be found in the examples.php file in the Github repository. As always, we invite you to join us on Github; pull requests and issues are always welcome.