Post Formats – More Creative Ways For A Theme

First day of our Advent Calendar we show tiny code snippets and brief informations for the Post Formats from WordPress version 3.1.

Some theme authors wanted more defined formats - they wanted the feature "post formats". This new functionality will be available in WordPress 3.1 and displays an additional meta-information. The Codex for this functionality is available already, and now it's up to the theme authors to use this new feature.
To use this function, you have to activate it with the Theme. This is controlled, similar to other theme features since version 3.0, over a function. The following syntax gives some of the possible post formats and these can then be used directly on the article, as the following screenshot shows.

Like in thumblr you can design the according article. Via the defined values you can use this across themes. The format will be output with the function body_class() for instant, which creates a class, which you can access via CSS. An exmaple for the value Aside of the post format.

<body class="single single-post postid-52 single-format-aside">

Alternatively there are conditional tags and functions to get to the assigned type:

echo get_post_format();

As so often depends the creativity and usage on the developer. The biggest benefit is probably that defined values exist and as a theme author you can respond to these formats and as a developer you don't have to create a new meta box.

@Galen: The point of the core post formats feature is to offer a standardized set of formats that other themes can then use. When you switch your theme, you won't lose your format. I've spoken (and maybe had a beer or two with) the wonderful guys over at WooThemes, and WooTumblog will utilize post formats. They'll likely continue to use their own UI instead of the core UI -- and that's fine. It's just a baseline.