Created
June 21, 2013 19:35
-
-
Save michael-cannon/5833740 to your computer and use it in GitHub Desktop.
Filter testimonials_widget_query_args example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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