If you’re an avid WordPress developer like myself, you may have had a play about with the new “post formats” in WordPress 3.1. Great! What an awesome idea – now, how do I show only “standard” posts? Anyone..?
Yeah, it seemed almost impossible, but not quite! To query your WordPress posts by the standard post format only, you need to use the tax_query parameter, in conjunction with the NOT IN operator.
<?php
$args = array(
'showposts' => 9,
'tax_query' => array(
array( 'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array('post-format-video','post-format-quote'),
'operator' => 'NOT IN'
)
)
);
query_posts( $args );
while ( have_posts() ) : the_post(); ?>
<?php the_title(); ?>
<?php endwhile; wp_reset_query(); ?>
As you can see, I am using query_posts to define what posts I would like to bring back. I have told it to filter by the taxonomy of post_format, and I have listed an array of the post_formats available on my WordPress site. I have then set the operator to NOT IN; this means it will bring back any posts that are not in the above formats – which in my case is the remaining standard posts!
I hope this helps someone out, as it was hard to find much information on it. They should really make it a bit simpler to bring back the standard post format.









20:23 02/04/2011
Lovely write, good blog design, keep up the great work
17:57 01/07/2011
Thanks a ton – this helped me out of pinch.