Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

What, Whys, and How to’s of Post Formats in WordPress 3.1

Last updated on by
Elegant Themes
What, Whys, and How to’s of Post Formats in WordPress 3.1

Post formats is one of the exciting features that are coming in WordPress 3.1. But most beginners have no idea what are post formats, why should they matter to you, and how you can take advantage of this awesome feature. Well after going through the alpha version of WordPress 3.1, we have decided to explain the what, whys, and how to’s of Post formats feature that is coming within WordPress 3.1.

What are Post Formats?

Post Formats are meta information that can be used by themes to customize presentation of a post. Ok, now in plain english post format are a method of styling a specific post. By using this feature, you can specify the display “format” of a specific post. This feature expands the micro-blogging aspect of WordPress because now you can have videos, links, images, audios, quotes, statuses, etc. all in one place, and the best part is that they will be styled accordingly.

Examples of Usage

Lets take a look at Digging into WordPress official blog. They have two type of post styles on the homepage. One is a complete post which is displaying an excerpt, just like any other blog. But what is interesting is that they have a specific style of a post that are external links to other blog posts that they find useful for their readers.

Digging into WordPress Example Usage of Post Formats

Blogging is all about sharing resources, and often it is the case where blogger wants to just link to an external resource because he/she finds it useful for their readers. The main problem they face is that they have to make a new post in order to just tell the readers to go to another site. This creates confusion for the end-user because they do not know what type of post it is. Often, the user has to click on the full view of the post just to find out that the author wants them to view an external link. Even though there are tricks like this one, that lets you link to external links from post titles, this post format issue will fix it all. Theme designers can style the “link formats” to be displayed in a different way like Jeff Starr has for Digging into WordPress.

The power of this feature is too much to describe. Because now you can write short status posts like you would on twitter, and have it styled differently without doing too much of work. If you found a quote that you like, you can share it and have it stand out with one click. The bottom line is that the “post formats” feature will make WordPress a more complete blogging platform.

Why you want to use Post Formats?

Post formats replaces the need to use categories to accomplish the similar styling features. Until now, developers hacked WordPress categories to accomplish this effect which ends up creating a lot of clutter and confusion for new bloggers. Using post formats will not only cut down clutter in terms of categories, it will make your blog portable between themes that support those formats.

It will also make your blog more user-friendly for your readers because your user will know exactly what type of post they are viewing. Furthermore, it will make your blog more lively because you will have different style of posts on your blog page. Right now, most blog post display looks very dull because all posts look alike. The post formats will fill a much needed void within the WordPress powered sites.

How to Add and Use Post formats in WordPress 3.1

Just like post thumbnails, Menus, Custom Backgrounds, and Custom headers, the post formats will also be a theme activated feature. What this means is that this feature will only be available if your theme is compatible.

Warning: You must have a fair understanding HTML, CSS, and the functions of the WordPress loop to follow this tutorial.

In order to activate “post formats” in WordPress 3.1, you will need to open your theme’s functions.php file and paste the following code:

add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );

Note: aside, and gallery are not the only available post formats. The available list of post formats are:

  • aside – Typically styled without a title. Similar to a Facebook status update.
  • chat – A chat transcript.
  • gallery – A gallery of images.
  • link – A link to another site.
  • image – A single image.
  • quote – A quotation.
  • status – A short status update, usually limited to 140 characters. Similar to a Twitter status update.
  • video – A single video.

For the full list of post formats, refer to WordPress Codex.

Once you have added this code, you will see a new field in your post write panel in the right hand column where you see publish.

Post Format Option in Post Write Panel

Upon writing the post, you can change the format and hit publish. This will allow you to display your post in a pre-styled format.

But wait, we have not yet specified these pre-styled post formats anywhere in our theme. So right now, even if you select the format in your WordPress post panel, it will not make a difference because your theme does not know how to display it. For this, we will need to edit our post loop.

We are going to be utilizing the conditional tag: has_post_format()

if ( has_post_format( 'aside' )) {
  // code to display the aside format post here
} else if (has_post_format('gallery')) {
   // stuff to display the gallery format post here
} else if (has_post_format('link')) {
   // stuff to display the link format post here
}else {
   // code to display the normal format post here
}

Now what are you waiting for? Start preparing yourself for this awesome feature. We can only imagine WordPress being used more and more as a micro-blogging platform with new themes that will come out utilizing this feature.

Additional Readings:

WordPress Codex Post Formats
Post types and formats and taxonomies, Oh my!
Post Formats vs. Custom Post Types


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »
  • saurabh

    Now making categories as galleries is really simple.

  • http://www.worthdesigning.com.au Keely

    Where exactly is this chuck of code added?
    I can’t find a thing about this anywhere; not being a php programmer I don’t know where to put it.

    • http://www.wpbeginner.com Editorial Staff

      The code shown in the post which utilizes has_post_format() is what you will put inside your loop to give each post a specific styling.

  • http://www.doitwithwordpress.com Dave

    It looks like your code is missing a closing bracket in the first line. It currently reads:

    if ( has_post_format( ‘aside’ ) {

    but it should be:

    if ( has_post_format( ‘aside’ )) {

    Great tutorial as always.

    • hosseincode

      yeah, wpbeginer should have fixed this…

    • http://www.wpbeginner.com/ WPBeginner Support

      We have updated the post, thanks Dave.

  • Tom

    So, OK I am still a little confused about a few concepts here…can somebody please help me out? I apologize in advance for the crazy length of this post but I am new to WP ;)

    I understand the concept of posts, pages, categories and tags – that’s easy.

    As I now understand, the new feature of “post formats” (WP v3.1) relates to the styling of a “post” (think: “blog post”), whereas the concept of “post types” really means one of the five default WP “content types” (post, page, attachment, revisions, nav menus – see (http://codex.wordpress.org/Post_Types).
    Likewise, the new feature of “custom post types” (WP v3.0) relates to creating *new* “post types” (outside of posts, pages, etc.), what ever that might be.

    WOW…that sounds understandable in…t h e o r y.

    OK, I DO get the new “post format” in theory…but I am a visual type of learner, so I wanted to see what they could look like.

    So your example of the ‘link’ “post format” post at Digwp.com was good, but I also checked out some other themes, like: http://demo.themify.me/#theme=wumblr
    (side note here: confusing! – see how they refer to post formats as exactly that here: http://themify.me/themes/wumblr > Features… but at the top of that same page they call them “post types”).

    Anyhow…before I get to the “post types” feature of WP, I have a few questions about the “post formats” feature:

    1. Let’s say I want to make use of new “post formats” in an existing theme; I add these 10 different post formats in WP and specify them in the theme (as per your instructions). But then what..? How does the actual *DESIGN* for each of those post formats come about on the site?
    Is it likely that most theme developers (mostly for the paid-for ones) will update their themes (the coding part, plus the actual design of the “post format” part) – or should users wait for new themes to hit the market that offer this for the first time?

    What about theme frameworks – do we know of any that already offer child themes with the post formats feature incorporated? Some theme frameworks allow you to create (or radically customize) your own child themes based on a basic version, with not much or no coding involved…do we know if any providers have this level of customization already implemented?

    2. When I look at some of the themes that already use “post formats” (see: http://themify.me/demo/#theme=wumblr) – what I notice is that *some* of the category names of the individual post formats match the names in the list of standardized formats (see: http://codex.wordpress.org/Post_Formats#Supported_Formats) – but some don’t! The following names that the Wumblr theme uses are not on that list: ‘general’ and ‘notes’- while ‘aside’ and ‘gallery’ are on the list but not chosen category names for any of Wumblr’s new format type posts. So this leads me to ask…

    Compared to the usual practice of freely choosing names for categories (often for SEO purposes), what are the rules for naming categories for “post format” posts? Do they HAVE to match the names on the list of standard “post formats”? If not, how would that change the code you suggested in your article, following where you say: “We are going to be utilizing the conditional tag: has_post_format() …”? If you DID use names in that code that differ from the standardized list, would that not go against the rule of standardization and make it difficult to switch themes?

    I also wonder if by categorizing “post format” type posts by choosing names like: ‘link’ or ‘status’ or ‘quote’ for instance…how can anyone expect people to actively CHOOSE to click categories with THESE names, rather than posts that typically carry category names *describing their content*!!????

    With ‘video’ and ‘image’ and ‘gallery’ … I could still understand that people might actively and out of curiosity click those to be shown a list of all the posts with that type of content, but link, status, quote….?

    ~~So does anyone understand how all of this works?~~

    So I make it VERY short with my question on “POST TYPES” or more precisely “custom post types”:

    Where do THEY fit in here? I understand they are NOT the “blog post” type posts we are talking…but “custom” (=any type of content type BUT a post).

    ARE there already any themes having them implemented, and if so, can someone point me to some examples?
    ARE they handled by the theme or by a plugin?

    Thanks for your replies!!

    Tom ;)

    • http://www.wpbeginner.com Editorial Staff

      Hey Tom,

      Lets take a stab at your long question, one by one.

      Wumblr Theme by Themify was released before WordPress 3.1 (so note, they did not have Post Formats at that time). So they called them whatever they liked, in this case post types”. Which again is a conflicting vocabulary, we recommend that it should be called Content Types because the whole idea of post types is to be NOT posts, RIGHT? Anyways so I think you are confused because of the semantics that Wumblr used. Again you mentioned later on why Wumblr has its own custom post formats rather than the supported formats. Because it was released before Post Formats were available, so they went with what they thought should be good.

      You would have to specify in your theme’s CSS that if a post format “XXX” is called then add these styles. A good way to do this would be getting the themes that already support Post Formats and look how they do it. Or simply open your browser’s Source and you will see the default class that is added. Most frameworks will be compatible with Post Formats in their coming versions however not all child themes will be compatible. It is very likely that some theme developers may go back and add post formats to their old themes. But we can’t say for sure which ones will do that and which ones won’t. There are a lot of new themes that are already hitting the market. Woo Themes has some, Themify has some. StudioPress will be releasing their own very soon as well. So it is really up to you if you want to wait or not.

      Your category name does not have to match post formats. Post Formats, and categories are two separate taxonomies. You are free to name your category whatever you like.

      Custom Post (Content) Types and Custom Post Formats are two separate beasts. One is a custom taxonomy while other is a custom content type. They serve two separate purposes. Taxonomies are to make organizing and display of content types easier. Custom Post Formats are taxonomies and Post is a content type.

      Both Custom Post Types and Post Formats are handled by themes. However for Custom Post Types there are plugins that make your life easier. You can refer to our article about custom post types on this site that will show you the plugins.

  • http://hacksocialmedia.com Tony

    I’ve been creating posts using custom post types when it should’be been a post format.

  • ms-studio

    My big question is: can we customize the write/edit page for those post types?

    If yes, that would be a compelling reason to start using them immediately. Any pointers as how to do that would be appreciated, as http://codex.wordpress.org/Function_Reference/add_meta_box doesn’t give any clues.

    If not, Custom Post Types will be much more useful.

    • http://www.wpbeginner.com Editorial Staff

      That page in the codex explains it all. It shows that they are adding this meta box to the custom content type “post” and “pages”… They are adding the input fields, and they are saving it. Use that information, and build on top of it.

  • http://connorcrosby.me Connor Crosby

    If you download the WP 3.1 beta, the Twenty Ten theme supports aside and gallery.

  • http://www.couchcampus.com Phaethon

    Awesome. We’ll be able to add more style hooks to the loop outside of the official WP 3.1 post types too, right?

  • http://connorcrosby.me Connor Crosby

    Do you know possibly when 3.1 might be available for the public? I was actually just looking how to create a link style like digwp.

    • http://www.wpbeginner.com Editorial Staff

      WordPress 3.1 is set to be launched right before the holidays so around Mid December would be a fair date.

      • http://cubictwo.com Dre Armeda

        You can download 3.1 Alpha via the official SVN already.

  • http://www.barbaraling.com Barbara Ling

    Beyond awesome, this will be quite the killer feature indeed! Sharing this with my network this instant, thanks!

  • http://pippinspages.com Pippin

    This is awesome. Nothing that really enhances things from a developer’s perspective, but this will be great for end users.

  • http://www.thevictory.nl/tafeltennis/ Bjorn van der Neut

    So if I understand correctly its a little bit the same as copy the page.php to gallery.php modify it and in the page select as template “Gallery”.

    Only now its going to be not on page level but on post level?

    • http://www.wpbeginner.com Editorial Staff

      Yes essentially it is a method of built-in cross-compatible post templates.

      • http://www.thevictory.nl/tafeltennis/ Bjorn van der Neut

        Ok thanks! I use the plugin Impact (Payed version) for this functionality right now. I am also bussy with Genesis but I did not find that option at this moment.

        • http://www.wpbeginner.com Editorial Staff

          This option will come available in WordPress 3.1. It is not available yet.