WordPress Post Formats

‘Post formats’ is a neat WordPress feature that lets authors mark posts as a particular type and then allow the theme to style them accordingly. For example a user/blogger might find themselves just posting a picture with a caption and no other content. Such a post would likely make more sense if styled differently.

A post format is just a piece of information linked with each post stating the presentation type. Originally introduced in version 3 of WordPress, the supported formats are fixed at: aside, gallery, link, image, quote, status, video, audio, chat (transcript). Currently the falcon WordPress theme that powers this site doesn’t have support for post formats, I plan to change that whilst writing this.

There isn’t actually a great deal of implementation needed to support post formats on a minimal level. The whole idea is to modify presentation, so really it’s a theme’s stylesheet which is going to do the work for displaying different formats accordingly.

Step 1

Update functions.php to let WordPress know the theme supports post formats (via add_theme_support(), see the docs here for more information). Without this the option to assign a format is hidden from the post editor. Note that we don’t have to add support for all formats, the second argument to add_theme_support() is an array of formats we want to support. For the falcon theme I intend to add them as I find a need for them. For now I am just going to add support for quotes.

Step 2

Update any theme template files which handle displaying posts to include the post format CSS classes. In the case of the falcon theme, the call to post_class() is already used on the relevant templates. Beyond this, no further PHP code needs updating.

Step 3

Add any CSS styles to show the content differently. For example, adding support for the quote format you might choose to make <blockquotes> have a larger font than usual.

The CSS classes for all post formats are of the form format-[format name], e.g. format-aside or format-quote. These CSS classes are applied to the wrapper around the content, so you’ll want to add post format specific rules under these classes (e.g. .format-quote blockquote).

This post on the blog demonstrates the quote format used by the falcon theme. Note the varying presentation, including lack of title (obviously that’s optional).


Further details on post formats, including some suggestions on post markup, can be found within the WordPress Codex.

Looking for more post formats? The codex page explains that the list is fixed. There are plenty of alternatives to classifying posts which might be more suitable, such as categories or tags. If none of these fit, perhaps a custom taxonomy?
Dev WordPress
Back to posts