What’s New in WordPress 3.5: The Developer’s Perspective

What's New in WordPress 3.5: The Developer's Perspective

The final version of WordPress 3.5 is coming closer – the first release candidate has already been presented to the public. It means that we should have our hands dirty with testing. Today we are going to see what new things are under the hood of new WordPress release and what it means for developers.

What's New in WordPress 3.5: The Developer's Perspective

What’s New in WordPress 3.5

New Default Theme

The upcoming release is going to be packed with a new default theme – Twenty Twelve. The theme’s code and design were completely re-worked since the Twenty Eleven, that makes it truly clean and simple to use. It’s responsive out of the box, has a clean typographic approach, supports post formats and customisation options via Theme Customiser introduced in 3.4 version.

Twenty-Twelve Theme

Actually, you can get more information about it’s features on the official theme page at WordPress. The theme is also available for download from the WordPress repository, so you can start using it right now (that, I suppose, would be a pleasure).

Media Management Improvements

In this release the core team unites their forces to refresh the outdated media management functionality. First of all there is a new in-post media management interface. It is clear, intuitive and easy to use. The search for images, it’s selection and customisation are performed easily inside the single modal.

Users can select one or more images to embed into posts, one by one or in bulk. The gallery management is also slick and intuitive with drag-and-drop functionality. The following PressThis video episode is dedicated to all these new things, so that you can see them in action.

But what does it all mean for developers? It’s worth paying attention to following aspects.

Introduction of Backbone Library

The new interface is built upon the Backbone JS library which is now bundled with the core. If you are not familiar with Backbone, probably, the time has come to start. It could be easily predicted, that the library will get further usage in WordPress core.

By by incorporating it into their own plugins (or other projects) developers could build interfaces that behave like native ones. Backbone brings the MVC approach to UI building.

You can extend any component of it to create custom dialogues. A good example of such a dialogue is already presented in the core – Featured Image selection metabox. It creates a UI, that relies on defined models and views, but attaches your own events to them, allowing you to select a featured image instead of inserting it into the editor. You can see how it’s done directly in the source code -wp-admin/includes/meta-boxes.php.

Gallery Management

The native WordPress gallery finally gets a renewed concept – it does not rely on images “attached” to a post any more. Instead, the new interface allows you to select any set of images from the media library (or upload them immediately), organise them through a simple drag-and-drop process and insert into post using a familiar ‘gallery’ shortcode.

Gallery UI

If you do not need some sophisticated gallery functionality for your project, you can consider giving a native gallery a second chance. If you are not satisfied with native markup, provided by the core, – you can simply deregister the default shortcode and register again with your own custom screen function.

Edit Attachment Page

Edit Attachment Page

The media library itself also gets some refinements. The most important thing is that the attachment edit page now relies on the same code as any other post type’s page. That in particular means that you can easily add custom metaboxes to it as you normally do for other post types.

Other changes are related to the image edit dialogue – all image manipulations are now abstracted through the introduction of WP_Image_Editor class and handled through ImageMagic library, if your server supports it.

There is no UI (yet) for configuring the options available in ImageMagick, by default WordPress is using it to perform basic editing manipulations (resize, crop etc.) This is a welcome move because ImageMagick does a better job than GD of resizing images without losing quality and it will make it easier for plugin developers to extend. Actually you can take a closer look at WP_Image_Editor_Imagick class in the source code wp-includes/class-wp-image-editor-imagick.php to see for yourself how it’s implemented and could be extended.

Admin UI Changes

The core team continues to reorganise admin for unification and simplification of UI. There are some new things introduced like the ability to install the plugins marked as favourites in the wordpress.org repository, a new welcome screen, retina-ready graphics in admin and a refreshed look of UI elements (like buttons, panels etc)

Admin UI

But apart from these shiny toys there are a bunch of changes that could affect your project’s code.

Link Manager Hidden

The link manager has been removed from the admin UI. The appropriate links table is still present in the DB and link management functions are available, but the admin dialogue is hidden. This is default behaviour for the fresh 3.5 install, but for upgrades that have some links to display it will still be shown.

If you’d like to preserve it on a constant basis – there is a simple plugin.

Settings Changes

There are changes in the settings pages and corresponding options. In particular, the security page has been removed and the search engine privacy option has been shifted to Reading Settings. On the Reading page itself the charset option is hidden for new installs (assuming UTF-8 by default) and for upgrades that have already been set to UTF-8 (see reasoning in following ticket).

The Media Settings also have some changes: there is no way to specify the upload folder through the options dialogue (see the ticket for details). If you have to specify a custom upload folder location you should use UPLOADS constant in config file.

oEmbeds settings are also gone from the screen – oEmbeds are available by default. If you’d like to removed it, some custom filtering should be performed (detailed instructions). The width for an embed will be inherited from the theme or the content frame and the height will be set automatically to 1.5 times the total content width or 1000px whichever is smaller.

Speaking about oEmbed – there are additional content providers that are supported by default. In particular, the embeds from Instagram, Soundcloud and Slideshare are supported out of the box (you don’t need any plugins for that).

The Writing Settings page has lost the “size of post box” option – the editor now will depend on how you resize it and the value will be saved in cookies. At the same time the “remote publishing” option also has gone – XML-RPC is enabled by default and to disable it you have use xmlrpc_enabled filter hook (detailed instructions).

UI Elements Improvements

TinyMCE has been updated to the 3.5.7 version that includes tons of improvements such as support for HTML5 tags or performance enhancements. But what’s the most interesting thing is the introduction of the API for views which you can use to offer previews and interaction of elements from the visual editor.

For example, the embedded media or gallery are presented by corresponding views in the visual editor mode with controls.

Editor Views

The native theme’s customiser introduced in the 3.4 version has further improvements with a new color picker UI.

Color Picker UI

Now it’s easier to display taxonomy columns in edit posts tables (see the following ticket for details). It could be achieved by supplying show_admin_column => true parameter to register_taxonomy() function on taxonomy registration. If you are looking for a way to alter it’s default behaviour there is manage_taxonomies_for_{$post_type}_columns filter hook.

Various Changes in APIs and Functions

Some of the essential WordPress APIs have been improved in the 3.5 version. Thus, the queries for comments and users now support the meta_query syntax the same way as WP_Query does. For example, to query users by some meta (‘nickname’ for example) you should write:

$args = array(
        'meta_query' => array(
                array(
                          'key' => 'nickname',
                          'value' => 'editor'
                )
        )
);
$user_query = new WP_User_Query($args);

//loop trough results
if(!empty($user_query->results)){ foreach ($user_query->results as $user){
        
        printf("<p>We have found user: %s</p>", $user->data->display_name);
}}

On the whole, it’s a great movement toward the unification of query APIs in the core.

Another notable improvement is support of post__in value for orderby parameter of WP_Query. It looks small, but in reality this small improvement gives you a lot of flexibility in displaying queried items. If previously, the only option for custom ordering was the menu_order parameter, that preserved it’s value in any queried context, then now things become more flexible.

You simply have to submit IDs of posts in the desired order as ‘post__in’ query argument and make ‘orderby’ parameter equal to post__in. Voilà! You have a completely custom order for a given query. The approach allows, for example, to have a manually ordered gallery embedded through shortcode: gallery ids="5,25,18".

WordPress 3.5 introduces the WP_Post class that dramatically improves performance by loading selected post’s properties on demand. Unfortunately, it could not be extended (as many plugin developers probably expected), but… things may change in future.

It’s recommended to take notice of the fact that WordPress’s default memory consumption limit has been increased to 40MB. It has been done to prevent fatal errors in some cases in the dashboard when the memory consumption is very close to the limit. Developers promise that this would not take as “a licensee to further increase the side of the WordPress codebase”.

It is also worth mentioning that a lot of bundles external libraries were updated to the new version, in particular – SimplePie 1.3.1, jQuery 1.8.2., jQuery UI 1.9.1, already mentioned TinyMCE updated up to 3.5.7 and new JS library: Backbone 0.9.2 and Underscore 1.3.3 are now bundled with the core.

Conclusion

There are also plenty of different changes related to performance, security and bagfixes, so that it’s highly recomended to install the new version right now to test for possible incompatibility with your themes, plugins or other projects. If you find other changes and features, that were missing in our overview, please share them with us in the comments.

Do you like the new release? What is your favourite feature? Are you going to upgrade immediately? Let us know in the comments.

Deals

Iconfinder Coupon Code and Review

Iconfinder offers over 1.5 million beautiful icons for creative professionals to use in websites, apps, and printed publications. Whatever your project, you’re sure to find an icon or icon…

WP Engine Coupon

Considered by many to be the best managed hosting for WordPress out there, WP Engine offers superior technology and customer support in order to keep your WordPress sites secure…

InMotion Hosting Coupon Code

InMotion Hosting has been a top rated CNET hosting company for over 14 years so you know you’ll be getting good service and won’t be risking your hosting company…

SiteGround Coupon: 60% OFF

SiteGround offers a number of hosting solutions and services for including shared hosting, cloud hosting, dedicated servers, reseller hosting, enterprise hosting, and WordPress and Joomla specific hosting.