| 1 | Index: wp-includes/default-widgets.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/default-widgets.php (revision 11812) |
|---|
| 4 | +++ wp-includes/default-widgets.php (working copy) |
|---|
| 5 | @@ -633,21 +633,20 @@ |
|---|
| 6 | else if ( $number > 15 ) |
|---|
| 7 | $number = 15; |
|---|
| 8 | |
|---|
| 9 | - if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) { |
|---|
| 10 | - $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 15"); |
|---|
| 11 | - wp_cache_add( 'recent_comments', $comments, 'widget' ); |
|---|
| 12 | - } |
|---|
| 13 | + $comments = get_comments(array('number' => $number)); |
|---|
| 14 | |
|---|
| 15 | - $comments = array_slice( (array) $comments, 0, $number ); |
|---|
| 16 | -?> |
|---|
| 17 | - <?php echo $before_widget; ?> |
|---|
| 18 | - <?php if ( $title ) echo $before_title . $title . $after_title; ?> |
|---|
| 19 | - <ul id="recentcomments"><?php |
|---|
| 20 | - if ( $comments ) : foreach ( (array) $comments as $comment) : |
|---|
| 21 | - echo '<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>'; |
|---|
| 22 | - endforeach; endif;?></ul> |
|---|
| 23 | - <?php echo $after_widget; ?> |
|---|
| 24 | -<?php |
|---|
| 25 | + echo $before_widget; |
|---|
| 26 | + if ( $title ) |
|---|
| 27 | + echo $before_title . $title . $after_title; |
|---|
| 28 | + |
|---|
| 29 | + echo '<ul id="recentcomments">'; |
|---|
| 30 | + if ( $comments ) { |
|---|
| 31 | + foreach ( (array) $comments as $comment) { |
|---|
| 32 | + echo '<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>'; |
|---|
| 33 | + } |
|---|
| 34 | + } |
|---|
| 35 | + echo '</ul>'; |
|---|
| 36 | + echo $after_widget; |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | function update( $new_instance, $old_instance ) { |
|---|