Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save michael-cannon/5833740 to your computer and use it in GitHub Desktop.
Save michael-cannon/5833740 to your computer and use it in GitHub Desktop.
Filter testimonials_widget_query_args example
add_filter( 'testimonials_widget_query_args', array( &$this, 'query_args' ), 10, 2 );
public function query_args( $args, $atts ) {
global $wpdb;
$args['post_type'] = $atts['post_type'];
$no_cache = $atts['no_cache'];
if ( $no_cache ) {
$args['no_cache'] = 1;
}
if ( empty( $args['post__in'] ) ) {
$post__in = array();
} else {
$post__in = $args['post__in'];
}
if ( ! empty( $post__in ) ) {
$post__in = array_unique( $post__in );
$args['post__in'] = $post__in;
}
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment