Add widget_comments_args and widget_post_args filters. props ramiy, fixes #16159.

git-svn-id: https://develop.svn.wordpress.org/trunk@20047 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-02-29 21:56:24 +00:00
parent d7b7ac8c1b
commit 5e9b785d5d
1 changed files with 2 additions and 2 deletions

View File

@ -543,7 +543,7 @@ class WP_Widget_Recent_Posts extends WP_Widget {
if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) )
$number = 10;
$r = new WP_Query(array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true));
$r = new WP_Query( apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) ) );
if ($r->have_posts()) :
?>
<?php echo $before_widget; ?>
@ -649,7 +649,7 @@ class WP_Widget_Recent_Comments extends WP_Widget {
if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) )
$number = 5;
$comments = get_comments( array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) );
$comments = get_comments( apply_filters( 'widget_comments_args', array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) ) );
$output .= $before_widget;
if ( $title )
$output .= $before_title . $title . $after_title;