Understanding Post Formats in WordPress

Listen to this article

Usually when people create posts in WordPress, they tend to ignore the Post Format option provided. By default, the standard format is selected, which satisfies the need for most users. But then why does WordPress provide us with different options for post formats? Which post format should you use and when? Let’s get some basics clear.

WordPress Post Formats


What are Post Formats Anyway?

Post Format is a theme feature, used as an indication, to identify the data in a post, and present it accordingly. By default WordPress provides nine types of post formats. The post format you select, should depend on the content you add in your post.

For example: If your post contains a video, you should use the Post Format Video. One could ask, what if I have content in the post as well, along with the video. Well, if the video is the main focus of the post, or if you need the video to be tagged, along with other videos, you need to set the post format to Video.

Default Post Formats WordPress

So are Post Formats a taxonomy. Well, tags or categories can be used to identify similar type of content, but to control the presentation of particular content types, WordPress introduced Post Formats. The advantage Post Format brings to a theme, is the ability to present different kinds of data, differently. Also, because this is a feature of a theme, you can seamlessly shift to another theme, and still maintain a difference in presentation for different post formats.


Post Formats v/s Custom Post Types

If post formats are used to identify and structure the display of certain types of content, are they the same as custom post types.

Post formats are only used for presentation, of mainly (and other post types, if your theme supports it). Also, at the cost of repeating myself, Post Formats are a standard in theme feature. Okay, so this time I used the word ‘standard’. The reason being, that post formats are a way to standardize data presentation across themes. If custom post types are used it the theme, to display, say video content differently, when a user switches the theme, he will lose the formatting.


Can you Create Custom Post Formats?

No. WordPress does not allow the creation of custom formats, and for a reason. The answer is the same. Post Formats are a standard across themes. Creating custom post format in a particular theme, defeats the purpose of the standard.


How to use Post Formats when creating a Theme

Providing support for Post Formats

When developing themes, you need to add support for Post Formats. These changes have to be made in your functions.php. For example, you would need to add:

[pre]add_action( ‘after_setup_theme’, ‘add_post_format_support’ );
function add_post_format_support() {
add_theme_support( ‘post-formats’, array( ‘video’, ‘audio’, ‘image’ ) );


This will display a ‘Format’ option in your post edit screen. If you want to use Post Format for different post types, you need to add support for a particular post type. For example:

[pre]// add post-formats to post type page
// same can be used for a custom post type
add_post_type_support( ‘page’, ‘post-formats’ );[/pre]


But your task does not end here. The presentation of a post type using the post format will also have to be done by the theme.


Create content-{post-format}.php

In actuality, you can present a format for a post, any way you like. But it makes sense to logically format posts. For example, for a video, you could display title and the video, you need not display the author name. But for a quote, you need not display the title. You could only display the quote and the author name.

For each post format your theme supports, you need to create a content-{post-format}.php. In your WordPress loop, you need to ensure that the associated post format file is picked up, instead of the default content.php.


[pre]if ( have_posts() ) :
while ( have_posts() ) :
// pick the template for the post format.
get_template_part( ‘content’, get_post_format() );

Using post formats in WordPress allows you to present posts differently, using a single loop. Learn to embrace post formats when your posts are centered around images, videos, audio files, or you have dedicated posts for status messages, quotes, links to other sites, etc.


Bharat Pareek

Bharat Pareek

Leave a Reply

Your email address will not be published. Required fields are marked *

Get The Latest Updates

Subscribe to our Newsletter

A key to unlock the world of open-source. We promise not to spam your inbox.

Suggested Reads

Join our 55,000+ Subscribers

    The Wisdm Digest delivers all the latest news, and resources from the world of open-source businesses to your inbox.

    Suggested Reads