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

git-svn-id: http://svn.automattic.com/wordpress/trunk@20047 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2012-02-29 21:56:24 +00:00
parent f11938fde4
commit 814d899e88
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;