I was busy working with WordPress since last couple of months. In WordPress version 3.1, WordPress announce new feature “Post Format” which is meta information of post to improve the look and presentation of the post. It is very easy to use and very helpful for making attractive theme.
By default, WordPress provides 9 post formats which you can refer on below link.
By default post format is not added for any post type. You need to add couple of line to make it visible in admin and use the post formats meta information features.
You can use below code to make post formats visible in wp admin for add/edit posts. Add this line in your theme’s functions.php file.
add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
Above code will make post format visible for post only. If you want to use post format feature for page and custom post types than follow the below line of code.
// add post-formats to post_type 'page' add_post_type_support( 'page', 'post-formats' ); // add post-formats to post_type 'my_custom_post_type' add_post_type_support( 'my_custom_post_type', 'post-formats' );
Once you assign post formats to posts than you can retrieve it using below line of code.
get_post_format() OR if ( has_post_format( 'video' ))
You can assign post format to group of posts and assign some icons to determine the post. This makes your theme more attractive.
Post Formats in WordPress, New Post Format, Get Post Format WordPress, Post Format for Custom Post Type, Post Format Meta Information, Post Format Support Theme