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 Link
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 Link
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 Link
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 Link
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 Otto6. I also recommend his article on leveraging the theme customizer in your own themes7.
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 Revamped Link
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.
Internationalization Changes Link
Back in the second half of December last year, WP Polyglots (the translation team) announced8 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 Link
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 Ticket10 (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 Link
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 Milestone11 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 #1831112
- Twenty Ten and Twenty Eleven themes updated to support new features #2044813
- Theme installer supports child themes #1377414
- WP_Query core performance upgrade #1853615
- Clicking on an empty space in the toolbar will scroll the page to the top #1875816
- Incorrectly displayed author meta fields fixed #2028517
- Failed cURL redirect fixed #2043418
- Spam comments are now excluded from the dashboard #1422219
- Theme editor support for special theme name characters #1650720
- Retina display icons added #2029321
- Already installed themes excluded from theme search #2061822
- Args added to the recent post and comments widget #1615923
- New comments can be added from the editor #1552724
Updates Of External Libraries Link
- PHPMailer updated to 5.2.1 #1988726
- TinyMCE updated to 3.4.8 #1996927
- jQuery updated to 1.7.2 #2033928
- jQuery UI updated to 1.8.20 #2055929
- SimplePie updated to 1.2.1 #1830930
- hoverIntent updated to r6 #1931131
Want To Chip In? Link
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 RC233 or you can install the Beta Tester Plugin34 to grab all the latest nightlies and be on the bleeding edge!
- 1 https://www.smashingmagazine.com/wp-content/uploads/2012/06/wp34featured.jpg
- 2 http://codex.wordpress.org/Post_Thumbnails
- 3 https://www.smashingmagazine.com/wp-content/uploads/2012/06/custombg.png
- 4 http://make.wordpress.org/themes/2012/04/06/updating-custom-backgrounds-and-custom-headers-for-wordpress-3-4/
- 5 http://sabreuse.com/flexible-headers-in-wordpress-3-4-themes/
- 6 http://ottopress.com/
- 7 http://ottopress.com/2012/how-to-leverage-the-theme-customizer-in-your-own-themes/
- 8 http://wppolyglots.wordpress.com/2011/12/18/moving-locale-specific-modifications-to-core/
- 9 http://nacin.com/2012/03/29/page-templates-in-subdirectories-new-in-wordpress-3-4/
- 10 http://core.trac.wordpress.org/ticket/20103
- 11 http://core.trac.wordpress.org/milestone/3.4
- 12 http://core.trac.wordpress.org/ticket/18311
- 13 http://core.trac.wordpress.org/ticket/20448
- 14 http://core.trac.wordpress.org/ticket/13774
- 15 http://core.trac.wordpress.org/ticket/18536
- 16 http://core.trac.wordpress.org/ticket/18758
- 17 http://core.trac.wordpress.org/ticket/20285
- 18 http://core.trac.wordpress.org/ticket/20434
- 19 http://core.trac.wordpress.org/ticket/14222
- 20 http://core.trac.wordpress.org/ticket/16507
- 21 http://core.trac.wordpress.org/ticket/20293
- 22 http://core.trac.wordpress.org/ticket/20618
- 23 http://core.trac.wordpress.org/ticket/16159
- 24 http://core.trac.wordpress.org/ticket/15527
- 25 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
- 26 http://core.trac.wordpress.org/ticket/19887
- 27 http://core.trac.wordpress.org/ticket/19969
- 28 http://core.trac.wordpress.org/ticket/20339
- 29 http://core.trac.wordpress.org/ticket/20559
- 30 http://core.trac.wordpress.org/ticket/18309
- 31 http://core.trac.wordpress.org/ticket/19311
- 32 http://core.trac.wordpress.org/report/6
- 33 http://wordpress.org/wordpress-3.4-RC2.zip
- 34 http://wordpress.org/extend/plugins/wordpress-beta-tester/
Hold on, Tiger! Thank you for reading the article. Did you know that we also publish printed books and run friendly conferences – crafted for pros like you? Like SmashingConf Barcelona, on October 25–26, with smart design patterns and front-end techniques.