Ticket #21485: 21485.2.diff

File 21485.2.diff, 960 bytes (added by DrewAPicture, 10 months ago)

+ Readability

Line 
1Index: wp-includes/default-widgets.php
2===================================================================
3--- wp-includes/default-widgets.php     (revision 21445)
4+++ wp-includes/default-widgets.php     (working copy)
5@@ -562,8 +562,18 @@
6                if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) )
7                        $number = 10;
8 
9-               $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 ) ) );
10-               if ($r->have_posts()) :
11+               $r = new WP_Query(
12+                       apply_filters( 'widget_posts_args', array(
13+                               'posts_per_page' => $number,
14+                               'no_found_rows' => true,
15+                               'post_status' => 'publish',
16+                               'ignore_sticky_posts' => true,
17+                               'post__not_in' => array( get_the_ID() )
18+                               )
19+                       )
20+               );
21+               
22+               if ( $r->have_posts() ) :
23 ?>
24                <?php echo $before_widget; ?>
25                <?php if ( $title ) echo $before_title . $title . $after_title; ?>