Post formats

Post formats have been introduced to WordPress in version 3.1. This is an innovative way for WordPress user to simulate Tumblr behavior and use the oldest “Post” feature in the platform to post quotes, links, images and other formats with different formatting.

In order for one to design specific image or quote behavior we used to create categories with custom templates or write custom post types with additional functionality to them. This requires additional coding for styling and separates from the most standard feature of WordPress – blog posting. That’s why post format have been added in v 3.1.

By default twenty ten (the latest one ) and twenty eleven themes have post formats enabled right below the Publish section in the Add New Post page. You could add your own post format functionality to your theme with few steps:

add_theme_support('post-formats',array(

'aside','gallery','image','link','quote','status','video','audio'));

This would include a list with the post formats you support in the theme. The next thing to do is a combination between post formats and styling. This could be done in different ways, easiest includes switch statement or couple of conditional statements with get_template_part() in the single.php. Each format styled its own way. Like the following:

if ( has_post_format( 'aside' )) {
get_template_part('format', 'aside');
} else if ( has_post_format( 'image' )) {
get_template_part('format', 'image');
} else if ( has_post_format( 'link' )) {
get_template_part('format', 'link');
} else if ( has_post_format( 'quote' )) {
get_template_part('format', 'quote');
} else {
get_template_part('format', 'regular');
}

Your thoughts?