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. ;)

WordPress Query Comprehensive Reference

There are a couple of spots that I always keep handy when looking for information about WordPress’ query handling. Consider this Gist an addition to my list:

WordPress Query Comprehensive Reference

Which helpful, recent resources do you use for information about WordPress’ query? I prefer to hit the Codex (WP_Query and query_posts) and also just dig directly into wp-includes/query.php.

Internationalization: You’re Probably Doing It Wrong

Fun fact of the day: about 37% of WordPress downloads are for non-English, localized versions.

So as a plugin or theme author, you should be thinking of localization and internationalization (L10N and I18N) as pretty much a fact of life by this point.

An excellent post from Otto on improvements to make and pitfalls to look out for when performing i18n on your WordPress theme.

* { box-sizing: border-box; } FTW

Paul Irish on HTML element widths being inclusive of padding at all times. That is to say if I define my box as 200 pixels wide then it should stay at a total of 200 pixels, no matter what I use for its padding value.

The money shot is as follows:

* { /* apply a natural box layout model to all elements */
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
}

Also, an interesting read on using * and its impact on performance.

You might get up in arms about the universal * selector. Apparently you’ve heard its slow. Firstly, it’s not. It is as fast as h1 as a selector. It can be slow when you specifically use it like .foo > *, so don’t do that. Aside from that, you are not allowed to care about the performance of * unless you concatenate all your javascript, have it at the bottom, minify your css and js, gzip all your assets, and losslessly compress all your images. If aren’t getting 90+ Page Speed scores, its way too early to be thinking about selector optimization.

As with most CSS, there’s no one-size-fits-all choice for this. At times it makes sense (it’s used on the WordPress.com Theme Showcase, selectively though) and at other times it doesn’t.

I like it, though.

Head over to Irish’s site to weigh in or drop a comment here with your thoughts.