Forked from michael-cannon/testimonials_widget_query_args.php
Created
May 27, 2015 06:26
-
-
Save subharanjanm/67dc5192d9763f7c805e to your computer and use it in GitHub Desktop.
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( 'tw_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