Ticket #15400: 15400.patch
File 15400.patch, 1.8 KB (added by , 15 years ago) |
---|
-
wp-includes/default-widgets.php
648 648 $number = 5; 649 649 else if ( $number < 1 ) 650 650 $number = 1; 651 651 add_action('comments_clauses', array( 'WP_Widget_Recent_Comments', 'comments_query_filter')); 652 652 $comments = get_comments( array( 'number' => $number, 'status' => 'approve' ) ); 653 remove_action('comments_clauses', array( 'WP_Widget_Recent_Comments', 'comments_query_filter')); 653 654 $output .= $before_widget; 654 655 if ( $title ) 655 656 $output .= $before_title . $title . $after_title; 656 657 657 658 $output .= '<ul id="recentcomments">'; 658 659 if ( $comments ) { 660 659 661 foreach ( (array) $comments as $comment) { 660 $output .= '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>'; 662 get_post($comment); 663 664 $output .= '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment) ) . '">' . get_the_title($comment) . '</a>') . '</li>'; 661 665 } 662 666 } 663 667 $output .= '</ul>'; … … 692 696 <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p> 693 697 <?php 694 698 } 699 700 function comments_query_filter($pieces) { 701 global $wpdb; 702 703 $pieces['join'] .= " LEFT JOIN $wpdb->posts ON ( $wpdb->comments.comment_post_ID = $wpdb->posts.ID )"; 704 705 return $pieces; 706 } 695 707 } 696 708 697 709 /**