A lot of people have been debating back and forth lately about post formats and custom post formats. This discussion also gets all confused with post types, and custom taxonomies, and categories, and tags… It’s time for some clarity. Mark had a really good post on the topic, but I think this needs to be explored in more detail.

Also, can’t have a good explanation without a bad analogy. I mean, this is the internet, right? So I should probably try to relate it to cars somehow.

A Post Type as a Car

Okay, so let’s say we have a post type. It’s called “car”. Anything that even vaguely resembles a car (including trucks, SUVs, jeeps, fire engines) gets lumped together in this post type.

We can categorize cars by type: Truck. Van. Hummer. Ford. Whatever.

We can add tags to cars: Four-door. Premium-sound. 6-disc-changer. Etc.

We can come up with custom taxonomies for them: A Color taxonomy could contain red, blue, black, silver, white, brown, etc.

The point here is that the post type is the thing itself, the various taxonomies are merely descriptions of it. You wouldn’t have both a “car” and a “truck” post type, because those are the same type of thing. If you prefer to be generic, you could make your post_type into “automobile”, which sorta fits both. That’s just a matter of naming choice.

Post types are NOUNS. Taxonomy terms are ADJECTIVES. Taxonomies themselves are related groups of adjectives.

This is why people using post types for things like Podcasts or Comic Strips or Video or something else are just fundamentally wrong. They’re using different nouns to describe the same thing, when they should be using the adjectives to sort out what those things are.

Displaying Different Things Differently

Historically with WordPress, categories have been used for more than just ways to classify posts. They’ve often been used to define different ways of displaying something.

The classic example is an “aside”. An aside has been traditionally defined as, basically, a short form post. Matt loves asides and he uses them far more often than long format posts:

A couple of aside posts on ma.tt

A couple of aside posts on ma.tt

Matt also uses a special format for his gallery posts:

One of ma.tt's gallery posts

One of ma.tt's gallery posts

Compare these to his normal long format posts:

A normal long format post on ma.tt

A normal long format post on ma.tt

You can easily see some of the differences. Asides don’t display a title. Galleries display a photo on the left hand side and the title is shortened and to the right. Long format posts have that double line underneath them, and also show the categories (essays in the above case).

The way he does these, and the way they have traditionally been done in WordPress in the past, is to co-opt categories. So he has an “Asides” category, and a “Gallery” category. In the code for his theme, he then has code that looks kinda like this:

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

Then, when he makes a post, he just picks the right category for it and that changes how it shows up on the site.

The problem is that this is a bit lame. Categories should be adjectives describing the post, not sorting them into functionally different buckets for use by the theme. Sure, you can use them that way, but that’s confusing to some users. You could use tags in the exact same way with the has_tag() function, but that doesn’t make it a good idea.

Post Formats (coming soon to a WordPress 3.1 near you)

Enter Post Formats. Tumblr has had these for a long time:

Tumblr's post formats

Tumblr's post formats

Basically they just define a format for a post to fit into at display time. So the theme could say “asides won’t have a title displayed for them”, and voila. A theme can do something like this to define what formats it supports:

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

And it can do something like this when displaying things differently:

if ( has_post_format( 'aside' ) ) {
   // display the aside format
}

So there we go. Theme authors can define what formats they support, and they can style those formats appropriately. And we didn’t use categories at all.

Additional: For those people trying to implement this in themes, post formats also add new styles to the post_class() call. You can use .format-XXX to style based on post formats on a post.

Custom Post Formats and why you don’t need them

As soon as this was announced, naturally theme authors got up in arms, because theme authors are a rowdy bunch of folks. They like to do things their own way. So there was instantly the question of “how do I add my own format”? The answer is: you don’t, nor should you even think about it.

Why? Why prevent customization? Think of it from the perspective of the user:

  • They’ve got an existing set of posts.
  • Those posts have formats.
  • They switch to your theme, which uses some custom formats.
  • Now their own posts don’t display properly with the new theme, because it’s using a whole different set of formats.
  • Bad user experience, that is.

Now, from the perspective of a theme author, I understand the reasoning here. You want to be able to display things differently.

The problem is that you were already able to do that before.

Custom taxonomies have been around a long time. All you had to do was to a) create a custom taxonomy (call it “mytheme_formats”), b) allow users to sort posts into your taxonomy, and c) display things differently in the theme based on the terms in that taxonomy.

Post Formats is just a taxonomy. It’s a set of adjectives, describing the nouns that are the posts. So now we have “aside posts” and “gallery posts” and “chat posts” and “video posts” and so on. If you want to make your own formats, then you’ve had that ability forever. Why have you not already used it?

The answer to why you didn’t do it before is because there was no standard set of formats.

Without a standard set to work with, users won’t have any idea what your formats mean. You have to write documentation. You have to educate the user. You have to explain what this weirdness in your theme is.

Post formats changes that. Now you have a standard set of formats, and the user, having used other themes that support those formats too, will have some idea of what they mean already. But in order for this to work, themes must all use the same basic formats. There has to be a standard set of adjectives to describe the posts.

If you want to create your own set, then create your own taxonomy and box to have your set in it. But don’t complain when users don’t understand why your theme’s formats don’t mesh with the formats of every other theme that does support them.

The point of standards is to be standard. You don’t have to support the standard, but you also will have to deal with the consequences of being non-standard.

Summing up

In the end, you want to present things to your users in a method that causes the least confusion. If your user wants to display things in a single stream, then those things need to be Posts. If the user wants different things in that stream to display in different ways, then you should use a taxonomy to do that, and the post format taxonomy provides a nice and easy way to standardize that and be compatible with other themes.

If you want to go it alone with custom things, feel free, but be aware of the risk.

Shortlink:

97 Comments

  1. […] contributor Otto wrote a great post about Post Formats several months ago that is definitely worth the […]

  2. […] Otto: Post Types and Formats and Taxonomies, Oh My! (Please read the other relevant articles on Otto’s site) […]

  3. […] thoughts and suggested reading: My colleague Otto Wood has previously written on this topic, in “Post types and formats and taxonomies, oh my!”, which does a great job summarizing the user’s point of […]

  4. great post and very useful…thank you for sharing

  5. […] Post Formats, Custom Taxonomies and Custom Post Types is to be found on Otto Wood’s blog: Post types and formats and taxonomies, oh my! and on Mark Jaquith’s blog: Post Formats vs. Custom Post Types. LD_AddCustomAttr("AdOpt", […]

  6. Very insightful. I was just researching for a new project and I came across Post Formats v Custom Posts. I am kind of at a stand still now need to research more…

    What will the client see when adding a custom post rather than a custom format? What’s the learning curve. In other words does portability trump my clients experience. I dunno. Ug.

  7. […] Post Types and Formats and Taxonomies, oh my! by Otto […]

  8. […] Im Krieg WordPress gegen Tumblr wird neues Öl in die Fritteuse gegossen. Post-Formate sind ein sehr eleganter Weg, Inhalte unterschiedlich und ein wenig dedizierter zu gestalten. Nun ist es ein leichtes, Chats, Videos, Artikel oder Bildbeiträge jeweils individuell zu gestalten. Einen tollen Artikel über Post types, formats und taxonomies gibt es hier bei Otto. […]

  9. […] Post Types and Formats and Taxonomies oh my! […]

  10. […] Post Types and Formats and Taxonomies, oh my! by Otto […]

  11. Bright logic, Otto, thanks for the article. Inspiring as usual.

  12. ps. The sign in with Twitter option has some weirdo. It doesn’t seem to work: it asks for name and the other fields and won’t send the comment.

  13. Great read. I love the frankness and clarity of your information. I learned a lot about it. Thanks for sharing!

  14. […] being able to visually show someone. People were so confused with the terminology, Mark Jaquith and Otto both published posts with explanations. At the time, I thought post formats would be awesome […]

  15. […] for using Post Formats, since the idea of them has been under debate, experienced some neglect, and created confusion amidst the emergence of a similarly named WordPress feature, Post […]

  16. […] Post Formats, Custom Taxonomies and Custom Post Types is to be found on Otto Wood’s blog: Post types and formats and taxonomies, oh my! and on Mark Jaquith’s blog: Post Formats vs. Custom Post […]

  17. I’m trying to understand if I should use the post formats.

    For that the title of the formats should be meaningful for the end-user, and particularly in this case for the editor.

    An that is content related.

    Of course one can take for granted that anybody may understand something similar for image, video, audio, link and perhaps gallery.

    But what about, aside (french en passant) status or quote.

    The doc says that “aside” generally wouldn’t show the title. But it could also be that it is not a main contain or should have a oder background color. Hand what happens if i want a theme, where I need aside red, aside blue, aside without title.
    And, please, I’m ready to discuss if I really need this kind of precision on a given project basis, but don’t tell me that this never can occur.
    Yes of course, If for all my comics strips should have a red background, my podcast a green and my videos a blue one I just can use taxonomy for that.
    But I surely shouldn’t use taxonomy to tell my theme how to behave.

    As I understand it, post formats have less to do with noun and adjectives, but for us developers, with content and technique:

    taxonomy should classify content, post formats the way a post behave, or more precisely what and how it is showed and what interaction it allows or offers.

    And than it would be all but helpful if a vocabulary that fits a given project and the end editors that will manage it could be introduced.

    What it comes about now is, I won’t use it, or I will attribute one option to quote, an other to aside and a third to status, not because the terms fit the described reality, but just because they are the ones that aren’t more or less related to obvious realities.

    In the mean time, I will probably use metadatas and taxonomy.

  18. A very informative article, thanks. There’s a very good WordPress Post Formats beginner’s guide on wpblog to learn all about Post Formats, for better understanding do have a look at it too. Thanks

  19. […] Post Formats is just a taxonomy. It’s a set of adjectives, describing the nouns that are the posts. So now we have “aside posts” and “gallery posts” and “chat posts” and “video posts” and so on. – Otto Wood […]

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Need to post PHP code? Wrap it in [php] and [/php] tags.