I'd like to filter out certain post formats from certain page templates. Specifically, I'd like to exclude link post types from the front page, so I can put them in a side bar, but still keep them in archive pages. I'd also like to exclude them from a variant of an RSS feed (but not all RSS feeds).

I know I can do this by editing the templates, but is there a way to do this via a plugin alone?

1 Answer 1


Since you're going to be modifying either the Loop Query or the Loop output, I would recommend modifying the appropriate template files directly.

To filter out Posts with the "quote" Post Format, simply wrap your Loop output (inside of the if-have-posts-while-have-posts-the-post) with:

if ( ! has_post_format( 'quote' ) ) {
    // Loop output goes here

Then, in your sidebar, you would create a custom Loop, e.g.:

$linkpostargs = array(
    'tax_query' => array(
        'taxonomy' => 'post_format',
        'field'    => 'slug',
        'terms'    => array( 'post-format-link' ),
        'operator' => 'IN'
$link_posts = get_posts( $linkpostargs );

foreach ( $link_posts as $link_post ) {
    // Custom Loop output goes here

(H/T Michael Fields for the query args)

I honestly don't know how you'd replicate this functionality using a Plugin alone.

  • This sounds like what I needed, Chip. I'll experiment with this shortly. I've seen plugins that allow you to exclude widets from certain templates through UI alone, and thought there might be similar filter hooks in place in other parts of the engine that allowed this kind of behavior for post formats too. I'll accept the answer here if nobody else points out a plugin based solution in the next few days. Jul 20, 2011 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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