Comments: dynamically update the document title text of the Comments List Table page when dynamically updating the number of comments awaiting moderation.

Fixes #33414. 


git-svn-id: https://develop.svn.wordpress.org/trunk@33821 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2015-08-31 17:57:32 +00:00
parent ff7e86d14c
commit af101dec19
2 changed files with 57 additions and 7 deletions

View File

@@ -104,10 +104,29 @@ $wp_list_table->prepare_items();
wp_enqueue_script('admin-comments');
enqueue_comment_hotkeys_js();
if ( $post_id )
$title = sprintf( __( 'Comments on “%s”' ), wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '…' ) );
else
$title = __('Comments');
if ( $post_id ) {
$comments_count = wp_count_comments( $post_id );
$draft_or_post_title = wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '…' );
if ( $comments_count->moderated > 0 ) {
$title = sprintf(
__( 'Comments (%s) on “%s”' ),
number_format_i18n( $comments_count->moderated ),
$draft_or_post_title
);
} else {
$title = sprintf( __( 'Comments on “%s”' ), $draft_or_post_title );
}
} else {
$comments_count = wp_count_comments();
if ( $comments_count->moderated > 0 ) {
$title = sprintf(
__( 'Comments (%s)' ),
number_format_i18n( $comments_count->moderated )
);
} else {
$title = __( 'Comments' );
}
}
add_screen_option( 'per_page' );