function wp_dashboard_recent_comments($sidebar_args) { global $comment; extract($sidebar_args, EXTR_SKIP); echo $before_widget; echo $before_title; echo $widget_name; echo $after_title; $lambda = create_function('', 'return 5;'); add_filter('option_posts_per_rss', $lambda); // hack - comments query doesn't accept per_page parameter $comments_query = new WP_Query('feed=rss2&withcomments=1'); remove_filter('option_posts_per_rss', $lambda); $is_first = true; if ($comments_query->have_comments()) { while ($comments_query->have_comments()) { $comments_query->the_comment(); $comment_post_url = get_permalink($comment->comment_post_ID); $comment_post_title = get_the_title($comment->comment_post_ID); $comment_post_link = "<a href='{$comment_post_url}'>{$comment_post_title}</a>"; $comment_link = '<a class="comment-link" href="' . get_comment_link() . '">#</a>'; $comment_meta = sprintf(__('From <strong>%1$s</strong> on %2$s %3$s'), get_comment_author(), $comment_post_link, $comment_link); if ($is_first) { $is_first = false; ?> <blockquote><p>“<?php comment_excerpt(); ?> ”</p></blockquote> <p class='comment-meta'><?php echo $comment_meta; ?> </p> <?php if ($comments_query->comment_count > 1) { ?> <ul id="dashboard-comments-list"> <?php } // comment_count } else { // is_first ?> <li class='comment-meta'><?php echo $comment_meta; ?> </li> <?php } // is_first } if ($comments_query->comment_count > 1) { ?> </ul> <?php } // comment_count; } echo $after_widget; }