Twitter’s New Official WordPress Plugin Prioritizes Extensibility

It’s easy to get overwhelmed when visiting the WordPress.org plugin directory in search of a Twitter plugin, as you’ll turn up more than 3,000 Twitter-related extensions. Unless you’re running on recommendations or personal experience, it may not be easy to narrow down a quality plugin that keeps pace with changes to the Twitter API.

This week Twitter finally decided to release an official WordPress plugin to assist users in optimizing their sites for a Twitter audience. I spoke with Niall Kennedy, Developer Advocate at Twitter and contributor on its official WordPress plugin, about Twitter’s plans for the plugin. Kennedy is also listed as a contributor on both the official Facebook and Vine plugins for WordPress.

“Twitter regularly works with partners to implement Twitter features on their site,” Kennedy said. “Shipping an official plugin allows us to directly support publishers powered by WordPress and provide an example implementation of Twitter best practices for publishers on any platform.”

The plugin requires PHP 5.4 or later and offers many features that you many have already seen available via other extensions, including customization of embedded tweets, embedded Twitter videos, Tweet button for sharing content, Twitter Cards, integration with Twitter Analytics, a Follow button, and ads conversion tracking.

Many are wondering why anyone needs an official Twitter plugin, given that WordPress already has excellent oEmbed support for tweets. Kennedy confirmed that the new plugin plays nicely with the built-in oEmbed support, while building on top of it:

The Twitter plugin for WordPress enhances the oEmbed support built-in to WordPress with additional customization and functionality. We enhance the typical oEmbed response with additional integrations with WordPress APIs.

Our plugin loads Twitter’s widgets JavaScript asynchronously through wp_enqueue_script, omitting the script element typically inserted onto the page markup through the default oEmbed response.

Each embedded Tweet, added through a URL or shortcode, passes through the shortcode’s filter (shortcode_atts_tweet) for customization of embedded Tweet features across the site. The plugin handles fetching the correct oEmbed markup from Twitter’s servers and caching the unique result for the customization.

The plugin does not change MCE oEmbed handling in the admin view.

Kennedy declined to comment on why it took Twitter so long to release an official plugin, but hopes that WordPress developers will use it as a building block. Those who previously created Twitter plugins now have a solid example for how best to extend WordPress to customize Twitter’s latest features.

Designed to be Extensibile

The development team behind the plugin plans to add new features to it as they become available from Twitter. They recognize that it will not be realistic to offer every imaginable feature, but instead are prioritizing extensibility to make sure developers can easily create their own customizations.

“The plugin includes support for displaying Twitter-hosted video embeds, a new feature available to Twitter developers just in the past few weeks,” Kennedy said. “An official Twitter plugin makes it easy to roll out new features to publishers.

“ We’re working with other plugin developers to integrate features through filters where any overlap may occur ,” he said. Kennedy has a few ideas for the kinds of integrations that developers might want to build for the plugin using the WordPress APIs.

“Our plugin automatically generates Twitter Card markup to represent a post, making some best guesses for post formats built-in to Core,” he said. “We expect plugin developers creating more specific display experiences will be able to build on top of our base features to select the best Twitter Cards template for their content.”

Kennedy also believes the plugin can be further extended by SEO plugins to optimize content. “Some of the most popular WordPress plugins involve SEO,” he said. “We would like to integrate with SEO plugins to highlight the best titles, descriptions, and other detailed data provided by publishers to help their content stand out on Twitter.”

Additionally, he sees an opportunity for theme developers to make tweets a seamless part of a theme’s overall design. “Our embedded Tweet theming can be customized by theme authors to match the visual theme of their site,” Kennedy said. “Automatically adjusting Twitter theming components to a WordPress theme context would be pretty cool.”

If you’re looking to add the most common Twitter features to your WordPress site, you’ll be hard pressed to find a better plugin than the official one on WordPress.org. Kennedy confirmed that Twitter plans to support the plugin through its official support forums on WordPress.org and will also have an escalated support channel for managed hosting providers.