With WordPress 3.4 set to arrive this week, it’s a great time to familiarize ourselves with the new features and additions. The new version of WordPress brings many improvements, including custom backgrounds and headers, a live theme-customizer, revamped XML-RPC, better support for internationalization, and many bug-fixes and enhancements. Let’s dive in and see what WordPress 3.4 has in store!
Custom Headers And Background
When WordPress added featured images2 as a core feature in 2.9, a new function was added —
add_theme_support. It was (and is) obvious that this is a precursor of things to come: the standardization of theme features. Since its introduction,
add_theme_support handles post-formats, automatic feed-links, and now in version 3.4, custom backgrounds and headers will be added to the list.
Adding a Custom Background
To use this feature, just call the
add_theme_support() function with ‘
custom-background’ as the first argument, and a list of default options as the second. Here is an example showing the basic syntax:
$args = array( 'default-image' => get_template_directory_uri() . '/images/bg-default.png', 'default-color' => '#fafafa', 'wp-head-callback' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '' ); add_theme_support( 'custom-background', $args )
Once the code is in place, you’ll see the changes take effect in the WordPress Admin:
The new custom background facility in WordPress 3.4
Adding a Custom Header
Adding the custom-header options work in much the same way. In addition to the new way of defining them, you can now make them flexible in height or width, which is a great asset to theme designers.
$args = array( 'flex-height' => true, 'height' => 200, 'flex-width' => true, 'width' => 950, 'default-image' => get_template_directory_uri() . '/images/headers/header-default.jpg', 'random-default' => false, 'default-text-color' => '', 'header-text' => true, 'uploads' => true, 'wp-head-callback' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '', ); add_theme_support( 'custom-header', $args );
Once you add this code the relevant controls will show up in the Appearance tab and you will be able to set up your custom header and background-image.
The width and height is now ‘suggested’ (displayed in bold text)
Live Theme Customizer
I think one of the best features in recent times is the Live Previews or “The Customizer”. As someone who sells themes on Theme Forest, I welcome this addition because the more I can use default WordPress options, the less support I need to provide. The best way to familiarize yourself with this feature is to watch the following great overview from Otto7. I also recommend his article on leveraging the theme customizer in your own themes8.
We’ll be taking an in-depth look at this awesome functionality here on Smashing Magazine, but for this article, the live theme-preview feature is too complex to showcase concisely. If you’d like to get started, do read Otto’s article — it has everything you need to get things set up. Here’s the nutshell version for a quick preview.
The preview facility works in an object oriented fashion. To use it you will need to cover the following steps:
- Add the customizer (hook it to ‘customize_register’)
- Add an area of customization — a section (using
- Add a setting you want to be able to control (using
- Add the control which is used to modify your setting (using
- Customize the preview functionality to work in real-time
The live preview is brand-spankin’ new, but it’s already a very powerful tool. It will no doubt receive numerous updates and additions, so theme developers will finally have a common and also flexible way of letting users customize their themes.
XML-RPC is a specification and a set of tools that allow software running on different platforms to make procedural calls over the Internet. In essence, it allows communication between WordPress and other software. The most apparent use of XML-RPC is the remote blogging services that are offered by apps like Windows Live Writer and mobile apps.
WordPress 3.4 comes with a number of XML-RPC bug-fixes as well as some heavily requested features like support for post thumbnails, custom post types and taxonomies.
Back in the second half of December last year, WP Polyglots (the translation team) announced9 that they will be pouring a lot of work into the 3.4 release and beyond. As a result there a numerous upgrades in the internationalization functionality of WordPress:
- Comma-localization (for languages like Chinese and Arabic which do not use the standard comma)
- Some fields are now forced to be LTR (like password and login names)
- Translatable spell-checker language
- Single quotes, apostrophes and primes can be localized
- Translatable time-zone string
- Simplification of:
- Feed-language specification
- Start of the week
- RTL language designation
- Default secret-key text
- Placeholder text of database constants
- Translations are now split over three POT files —
- Default WordPress links can be translated
- Dashboard widgets can be translated
Beginnings Of A New API
For now you won’t notice much, with the main difference being that you can place template files in sub-directories. Under the hood, the new class will bring significant speed increases while searching for themes by reducing the filesystem operations to a bare minimum.
As you can see on the main Trac Ticket11 (scroll down a bit in the comments), there has been a lot of work done but the class is only scratching the surface of what we will be able to do later on. Flexible theme-management with better performance will help developers and users out a great deal — I can’t wait to see where this goes!
Bugs and Enhancements
With a total of 401 bugs fixed, 116 enhancements added, 3 requested features built and 52 tasks completed (at the time of writing) there is a lot more to this update than just the main features above. The WordPress 3.4 Track Milestone12 page has all the links and info you need to take a look at all that’s been done, and here’s a quick overview.
- HTML Support in image captions #1831113
- Twenty Ten and Twenty Eleven themes updated to support new features #2044814
- Theme installer supports child themes #1377415
- WP_Query core performance upgrade #1853616
- Clicking on an empty space in the toolbar will scroll the page to the top #1875817
- Incorrectly displayed author meta fields fixed #2028518
- Failed cURL redirect fixed #2043419
- Spam comments are now excluded from the dashboard #1422220
- Theme editor support for special theme name characters #1650721
- Retina display icons added #2029322
- Already installed themes excluded from theme search #2061823
- Args added to the recent post and comments widget #1615924
- New comments can be added from the editor #1552725
Updates Of External Libraries
- PHPMailer updated to 5.2.1 #1988727
- TinyMCE updated to 3.4.8 #1996928
- jQuery updated to 1.7.2 #2033929
- jQuery UI updated to 1.8.20 #2055930
- SimplePie updated to 1.2.1 #1830931
- hoverIntent updated to r6 #1931132
Want To Chip In?
If you’re not a coder, not to worry! Just using and testing the features can be invaluable as well! You can download WordPress 3.4 RC234 or you can install the Beta Tester Plugin35 to grab all the latest nightlies and be on the bleeding edge!
- 1 http://www.smashingmagazine.com/wp-content/uploads/2012/06/wp34featured.jpg
- 2 http://codex.wordpress.org/Post_Thumbnails
- 3 http://www.smashingmagazine.com/wp-content/uploads/2012/06/custombg.png
- 4 http://www.smashingmagazine.com/wp-content/uploads/2012/06/customheader.jpg
- 5 http://make.wordpress.org/themes/2012/04/06/updating-custom-backgrounds-and-custom-headers-for-wordpress-3-4/
- 6 http://sabreuse.com/flexible-headers-in-wordpress-3-4-themes/
- 7 http://ottopress.com/
- 8 http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own-themes/
- 9 http://wppolyglots.wordpress.com/2011/12/18/moving-locale-specific-modifications-to-core/
- 10 http://nacin.com/2012/03/29/page-templates-in-subdirectories-new-in-wordpress-3-4/
- 11 http://core.trac.wordpress.org/ticket/20103
- 12 http://core.trac.wordpress.org/milestone/3.4
- 13 http://core.trac.wordpress.org/ticket/18311
- 14 http://core.trac.wordpress.org/ticket/20448
- 15 http://core.trac.wordpress.org/ticket/13774
- 16 http://core.trac.wordpress.org/ticket/18536
- 17 http://core.trac.wordpress.org/ticket/18758
- 18 http://core.trac.wordpress.org/ticket/20285
- 19 http://core.trac.wordpress.org/ticket/20434
- 20 http://core.trac.wordpress.org/ticket/14222
- 21 http://core.trac.wordpress.org/ticket/16507
- 22 http://core.trac.wordpress.org/ticket/20293
- 23 http://core.trac.wordpress.org/ticket/20618
- 24 http://core.trac.wordpress.org/ticket/16159
- 25 http://core.trac.wordpress.org/ticket/15527
- 26 http://core.trac.wordpress.org/query?status=closed&component=External+Libraries&milestone=3.4&group=resolution&col=id&col=summary&col=component&col=owner&col=type&col=priority&col=version&desc=1&order=priority
- 27 http://core.trac.wordpress.org/ticket/19887
- 28 http://core.trac.wordpress.org/ticket/19969
- 29 http://core.trac.wordpress.org/ticket/20339
- 30 http://core.trac.wordpress.org/ticket/20559
- 31 http://core.trac.wordpress.org/ticket/18309
- 32 http://core.trac.wordpress.org/ticket/19311
- 33 http://core.trac.wordpress.org/report/6
- 34 http://wordpress.org/wordpress-3.4-RC2.zip
- 35 http://wordpress.org/extend/plugins/wordpress-beta-tester/