Make WordPress Core


Ignore:
Timestamp:
11/05/2008 07:09:20 AM (16 years ago)
Author:
markjaquith
Message:

Massive get_comment_link() performance improvements for posts with a lot of comments. props Viper007Bond. fixes #7956

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/widgets.php

    r9506 r9522  
    13881388
    13891389    if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) {
    1390         $comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");
     1390        $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");
    13911391        wp_cache_add( 'recent_comments', $comments, 'widget' );
    13921392    }
     
    13971397            <ul id="recentcomments"><?php
    13981398            if ( $comments ) : foreach ( (array) $comments as $comment) :
    1399             echo  '<li class="recentcomments">' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
     1399            echo  '<li class="recentcomments">' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_comment_link($comment->comment_ID) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
    14001400            endforeach; endif;?></ul>
    14011401        <?php echo $after_widget; ?>
Note: See TracChangeset for help on using the changeset viewer.