Daniel Pataki

About The Author

Daniel Pataki Hallo, my name is Daniel :) I build plugins, themes and apps - then proceed to write or talk about them. I’m the editor for the WordPress section here on Smashing Magazine and I contribute to various other online sites. When not coding or writing you’ll find me playing board games or running with my dog. Drop me a line on Twitter or visit my personal website.

What's New in WordPress 3.4

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!...

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!

wp34featured-500

Custom Headers And Background

When WordPress added featured images 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 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' The width and height is now ‘suggested’ (displayed in bold text)

Thanks to Chip Bennett and Amy Hendrix for their excellent posts on this topic.

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 Otto. I also recommend his article on leveraging the theme customizer in your own themes.

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:

  1. Add the customizer (hook it to ‘customize_register’)
  2. Add an area of customization — a section (using add_section())
  3. Add a setting you want to be able to control (using add_setting())
  4. Add the control which is used to modify your setting (using add_control())
  5. 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

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

Back in the second half of December last year, WP Polyglots (the translation team) announced 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
    • setup-config.php file translation
    • WPI18N* hardcoded translations
  • Translations are now split over three POT files — wordpress.pot, wordpress-admin.pot, and wordpress-admin-network.pot
  • Default WordPress links can be translated
  • Dashboard widgets can be translated

Beginnings Of A New API

While not advertised in the change-logs, Andrew Nacin has been working on a new API which will replace the get_themes() functionality.

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 Ticket (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 Milestone 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 #18311
  • Twenty Ten and Twenty Eleven themes updated to support new features #20448
  • Theme installer supports child themes #13774
  • WP_Query core performance upgrade #18536
  • Clicking on an empty space in the toolbar will scroll the page to the top #18758
  • Incorrectly displayed author meta fields fixed #20285
  • Failed cURL redirect fixed #20434
  • Spam comments are now excluded from the dashboard #14222
  • Theme editor support for special theme name characters #16507
  • Retina display icons added #20293
  • Already installed themes excluded from theme search #20618
  • Args added to the recent post and comments widget #16159
  • New comments can be added from the editor #15527

Updates Of External Libraries

It’s always worth checking out the external library update for a milestone. This version brings quite a lot, to name just the most important ones:
  • PHPMailer updated to 5.2.1 #19887
  • TinyMCE updated to 3.4.8 #19969
  • jQuery updated to 1.7.2 #20339
  • jQuery UI updated to 1.8.20 #20559
  • SimplePie updated to 1.2.1 #18309
  • hoverIntent updated to r6 #19311

Want To Chip In?

If you’d like to participate there are still a few days left and you can always help out after 3.4 as well. If you have the coding chops take a look at the open tickets for the next major release.

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 RC2 or you can install the Beta Tester Plugin to grab all the latest nightlies and be on the bleeding edge!

(JS)


More Articles on

Front-End Author Listing And User Search For WordPress

by Cristian Antohe

This article will guide you through the process of creating a front-end page in WordPress that lists your authors. We’ll discuss why you would want to do this, we’ll introduce the WP_User_Query class, and then we’ll put it it all together. At its core, WordPress is a rock-solid publishing platform. With a beautiful and easy to use interface, and support for custom post types and post...

Read more

How To Log In To WordPress Using A Social Network

by Kevin Muldoon

WordPress has a fairly straightforward registration system. To register, you only need to submit a user name and your email address. A password is then emailed to you and you can log in. This registration process can actually be made quicker by enabling visitors to sign up and log in using social media services such as Facebook, Twitter and Google+. A few months ago, in the comments area...

Read more

Creating Mobile-Optimized Websites Using WordPress

by Rachel McCollin

“Mobile Web design.” Unless you’ve been hiding under a bush for the last 18 months, you’ll know that it’s one of the hottest topics in the industry at the moment. Barely a week goes by without new tips being unveiled to help us hone our skills in making websites work as well — and as fast — as possible on mobile devices. Here are four ways to make your WordPress blog or website...

Read more