X

Add post formats support

WordPress Post Formats was introduced in WP 3.1 and let’s you define a format for your posts to display them differently according to what one that was chosen.

There are ten different formats you can choose from, and you can decide witch ones you want to support.

To check whether a post has a format or not, you can use this conditional tag:

Code Snippet:

if ( has_post_format( 'status' )):<br />
  echo 'this is the status format';<br />
endif;

You can also add the Format functionality to pages, or your own custom post type:

Code Snippet:

add_post_type_support( 'page', 'post-formats' ); // add to pages<br />
add_post_type_support( 'books', 'post-formats' ); // add to custom post type books

Code Snippet:

<?php add_theme_support( 'post-formats', array( 'status', 'gallery' ) ); ?>

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!