WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I hope this isn't a stupid question, but I can't find an answer. I just want to display (in the loop) what post format a post is in. I'm trying to avoid using a bunch of if / else if conditions.

I'm not trying to restyle the post based on format, just display "Gallery" or "Quote" or whatever the current post format is, given they are enabled for my current theme.

share|improve this question
Where did you set post format you want to know? – petermolnar Sep 27 '11 at 14:33
up vote 4 down vote accepted


echo get_post_format_string( get_post_format() );


Note, if you want a fail-safe output, try this:

if ( get_post_format() ) {
    echo get_post_format_string( get_post_format() );
} else {
    ehco 'Standard';

Or, if you want to store it in a variable:

$post_format_string = ( get_post_format() ? get_post_format_string( get_post_format() ) : 'Standard' );
// echo the result
echo $post_format_string;

Codex ref: get_post_format(), get_post_format_string()

share|improve this answer
Works perfectly Chip thanks very much. – jw60660 Sep 27 '11 at 14:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.