wp_dashboard_recent_comments [ WordPress Function ]
wp_dashboard_recent_comments ( No parameters )
| Defined at: |
|
Benzer Fonksiyonlar: _wp_dashboard_recent_comments_row, wp_dashboard_recent_comments_control, wp_dashboard_recent_drafts, wp_dashboard_rss_control, wp_dashboard_secondary_control
Display recent comments dashboard widget content.
Source
<?php
function wp_dashboard_recent_comments() {
global $wpdb;
// Select all comment types and filter out spam later for better query performance.
$comments = array();
$start = 0;
$widgets = get_option( 'dashboard_widget_options' );
$total_items = isset( $widgets['dashboard_recent_comments'] ) && isset( $widgets['dashboard_recent_comments']['items'] )
? absint( $widgets['dashboard_recent_comments']['items'] ) : 5;
$comments_query = array( 'number' => $total_items * 5, 'offset' => 0 );
if ( ! current_user_can( 'edit_posts' ) )
$comments_query['status'] = 'approve';
while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) {
foreach ( $possible as $comment ) {
if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) )
continue;
$comments[] = $comment;
if ( count( $comments ) == $total_items )
break 2;
}
$comments_query['offset'] += $comments_query['number'];
$comments_query['number'] = $total_items * 10;
}
if ( $comments ) {
echo '<div id="the-comment-list" class="list:comment">';
foreach ( $comments as $comment )
_wp_dashboard_recent_comments_row( $comment );
echo '</div>';
if ( current_user_can('edit_posts') )
_get_list_table('WP_Comments_List_Table')->views();
wp_comment_reply( -1, false, 'dashboard', false );
wp_comment_trashnotice();
} else {
echo '<p>' . __( 'No comments yet.' ) . '</p>';
}
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- #12131 (Admin/Dashbard hanging and getting 404 page due to ...
After much debugging (removing the plugins folder and commenting out pieces of the dashboard code), I tracked it down to wp_dashboard_recent_comments in ...
core.trac.wordpress.org - #16846 (wp_dashboard_recent_comments can generate hundreds ...
wp_dashboard_recent_comments can generate hundreds of queries. Reported by: ocean90, Owned by: Priority: high, Milestone: 3.1.1. Component: Comments ...
core.trac.wordpress.org - PHPXRef 0.7 : WordPress : Detail view of dashboard.php
wp_dashboard_recent_comments() ...
phpxref.ftwr.co.uk - dashboard.php - PHP Cross Reference of WordPress Source - Yoast
wp_dashboard_recent_comments() ...
xref.yoast.com