Granting Commit Access to Underscores

With Underscores’ growing popularity and continuing maturation as an open source project, we decided to take the next step and open up commit access to contributors outside of Automattic. Please join me in congratulating Philip Arthur Moore on becoming the first external committer to an Automattic project on GitHub.

Philip has been a fairly easy choice as we obviously know him well here at Automattic. He was with us for over three years and a driving factor in everything theme related during his time with us. But more importantly, he continues to care about Underscores and contribute in discussions and patches, and we know about his theme development skills and passion for world class themes.

We’re much more conservative with our Underscores goals and dreams than most people wanting to contribute, so it is important to us that committers share these values and understand where we see the project headed. We have no doubt that that is the case with Philip, who helped shaping Underscores from the day it started. Andrew Nacin recently published a post about how the WordPress project chooses committers, and while WordPress and Underscores are vastly different open source projects, there is still a lot to take away from it—especially around the qualities of a great contributor—that also applies to this project.

Underscores just recently celebrated its second birthday. It has become an integral part of many projects, not only at Automattic, but for theme developers all over the world. So we’re exited to have Philip back in a leading role and continue this journey with us!

HTML5 Galleries in WordPress 3.9

With the new release of WordPress will come the ability to declare support for HTML5 markup in galleries. Once a theme declared support, the definition list elements will be replaced by <figure> and <figcaption> for better semantics.

If you decide to not only adopt this new feature but also maintain backwards compatibility, then there are two ways to achieve that:

  1. Style not only the new HTML5 elements, but also add CSS selectors for the traditional definition list elements. This is the route we chose for _s to keep it as simple as possible.
  2. Filter the shortcode attributes and override the tag parameters. Since the shortcode_atts_gallery filter was introduced in 3.6, you’ll be backwards compatible with the latest two versions.

Continue reading “HTML5 Galleries in WordPress 3.9”

Advanced Translation Voodoo

This serves as another installment in the series about “Why We Do Things The Way We Do Them” in Underscores.

It is about a commit that we made almost a year ago. That commit dealt with a bug that a few themes have on WordPress.com, and which just recently came up again internally, on an old Trac ticket. Continue reading “Advanced Translation Voodoo”

Theme Development Enhancements In WordPress 3.8

Some news on recent changes for WordPress 3.8 that make theme development even easier:

Post Formats

From 3.8 onwards, theme developers will be able to check if a post has any post format associated by checking has_post_format() without passing an argument:

// Does the post have any format assigned to it?
has_post_format();

// Does the post have this specific format assigned to it?
has_post_format( 'aside' );

// Does the post have any of these formats assigned to it?
has_post_format( array( 'aside', 'image', ) );

Background Images

Additionally, it is now possible to be more specific about a theme’s custom background support. You can now specify default-repeat, default-position-x, and default-attachment arguments for background images. This is the full array of defaults when registering theme support now:

$defaults = array(
    'default-image'          => '',
    'default-repeat'         => 'repeat',
    'default-position-x'     => 'left',
    'default-attachment'     => 'scroll',
    'default-color'          => '',
    'wp-head-callback'       => '_custom_background_cb',
    'admin-head-callback'    => '',
    'admin-preview-callback' => '',
);

Miscellaneous

  • With the improved theme experience in the Appearance menu, WordPress can accommodate for even bigger screenshot sizes of your theme, the new standard size is now 880x660px!
  • If you have themes in the WordPress.org repository or plan to release a theme there (you should!), these three tags will be available to classify your theme appropriately: responsive-layout, fluid-layout, fixed-layout.
    They replace fluid-width and fixed-width, to make the terms broader and match web design terminology better. You can also classify your theme as accessibility-ready – if it is.

Why Hard Working Classes Slack in WordPress

Nathan Ford wrote a great article about how you can use the attribute selector to define styles for a multitude of classes that share a common element. Initially I thought this was great (I actually still think this is a great idea), and used it in _s and Twenty Thirteen to simplify the clearfix selector and some others. We used [class*="site"] and [class*="content"], to grab all classes that contained those two words, essentially addressing our entire page structure with two selectors. Awesome, right?

Well, it turns out there are a few issues with this approach. After a while we received a report that Modernizr uses a generatedcontent class on the html element, screwing with the rest of the site because the styles for the [class*="content"] selector were applied. We also received reports from WordPress.com, where users specified tags, categories, or post titles that contained one of our two words. Since WordPress adds all categories and tags as classes in post_class(), this, again, broke the site’s layout.

I still think this a valid approach in projects where you can control the class namespace. Since you can’t really do that in WordPress, it’s not a good approach for theme developers.

Don’t Update Your Theme (From _s)

I recently attended Steve Zehngut’s session on Underscores at WordCamp Los Angeles, where I was surprised to learn that a lot of developers are unsure how to update their themes with the changes we make on _s.

Version-less _s

For that we decided to make _s version-less, to prevent the feeling you need to update your _s-based themes with these constant changes. With no real roadmap, previously we bumped the version number arbitrarily whenever we felt like it, with a big enough change. Continue reading “Don’t Update Your Theme (From _s)”

Attachment Body Classes

There was an interesting bug reported for Twenty Twelve recently: The .single-attachment body class only gets applied when the attachment’s parent is a post (or custom post type). If the attachment’s parent happens to be a page, that class is missing.

In case you have been using .single-attachment to specify styles for the image attachment page, make sure to test your theme with images that have a page as a parent. And use the .attachment body class in the future. 😉

HTML5 Support in WordPress Core

I’m excited to share that we’re pushing things forward in WordPress 3.6 – default snippets for comments, the comment form, and the search form are updated with the latest HTML5 markup.

While the changes to both the search form and the comment form are rather marginal (added classes and some streamlined markup), the comment markup changed a bit more. The new version offers the best features from previous default themes and the pre-existing markup from core.

Continue reading “HTML5 Support in WordPress Core”

Validation and Sanitization in the Customizer

At Automattic, we exclusively use the Customizer for theme options instead of theme option pages. We believe that themes should only alter the display of content and should not add any additional functionality that would be better suited for a plugin. Since all options are presentation centered, they should all be controllable by the Customizer.

Continue reading “Validation and Sanitization in the Customizer”