Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created December 19, 2011 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/1498565 to your computer and use it in GitHub Desktop.
Save billerickson/1498565 to your computer and use it in GitHub Desktop.
Display Posts Shortcode - Exclude Posts
<?php
/**
* Display Posts Shortcode - Exclude Posts
* @author Bill Erickson
* @link http://wordpress.org/extend/plugins/display-posts-shortcode/
*
* @param array $args
* @param array $atts
* @return array $args
*/
function be_display_posts_shortcode_exclude_posts( $args, $atts ) {
if( isset( $atts['not_in'] ) ) {
$posts = explode( ',', $atts['not_in'] );
$args['post__not_in'] = $posts;
}
return $args;
}
add_filter( 'display_posts_shortcode_args', 'be_display_posts_shortcode_exclude_posts', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment