Post Format in WordPress

The Post Formats feature provides a standardized list of formats that are available to all themes that support the feature. Themes are not required to support every format on the list.

With a theme that supports Post Formats, a blogger can change how each post looks.

Available Post Formats

  • aside – Typically styled without a title. Similar to a Facebook note update.
  • gallery – A gallery of images. Post will likely contain a gallery shortcode and will have image attachments.
  • link – A link to another site. Themes may wish to use the first <a href=””> tag in the post content as the external link for that post. An alternative approach could be if the post consists only of a URL, then that will be the URL and the title (post_title) will be the name attached to the anchor for it.
  • image – A single image. The first <img /> tag in the post could be considered the image. Alternatively, if the post consists only of a URL, that will be the image URL and the title of the post (post_title) will be the title attribute for the image.
  • quote – A quotation. Probably will contain a blockquote holding the quote content. Alternatively, the quote may be just the content, with the source/author being the title.
  • status – A short status update, similar to a Twitter status update.
  • video – A single video or video playlist. The first <video /> tag or object/embed in the post content could be considered the video. Alternatively, if the post consists only of a URL, that will be the video URL. May also contain the video as an attachment to the post, if video support is enabled on the blog (like via a plugin).
  • audio – An audio file or playlist. Could be used for Podcasting.
  • chat – A chat transcript


Function Reference

  • set_post_format()
  • get_post_format()
  • has_post_format()
  • get_post_format_link()
  • get_post_format_string()


Adding Theme Support

Themes need to use add_theme_support() in the functions.php file to tell WordPress which post formats to support by passing an array of formats

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

Adding Post Type Support

// add post-formats to post_type 'page'
add_action('init', 'my_theme_slug_add_post_formats_to_page', 11);

function my_theme_slug_add_post_formats_to_page(){
    add_post_type_support( 'page', 'post-formats' );
    register_taxonomy_for_object_type( 'post_format', 'page' );

Using Formats

In the theme, make use of get_post_format() to check the format for a post

if ( has_post_format( 'video' )) {
  echo 'this is the video format';

Formats in a Child Theme

Calling add_theme_support() for post formats in a child theme must be done at a later priority than that of the parent theme and will override the existing list, not add to it.

add_action( 'after_setup_theme', 'childtheme_formats', 11 );
function childtheme_formats(){
     add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link' ) );

One thought on “Post Format in WordPress

  1. 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

Leave a Reply

Your email address will not be published.