Advertisements

wp_admin_bar_comments_menu

Definition:
function wp_admin_bar_comments_menu( $wp_admin_bar ) {}

Add edit comments link with awaiting moderation count bubble.

Parameters

  • $wp_admin_bar

Source code

function wp_admin_bar_comments_menu( $wp_admin_bar ) {

	if ( !current_user_can('edit_posts') )

		return;



	$awaiting_mod = wp_count_comments();

	$awaiting_mod = $awaiting_mod->moderated;

	$awaiting_title = esc_attr( sprintf( _n( '%s comment awaiting moderation', '%s comments awaiting moderation', $awaiting_mod ), number_format_i18n( $awaiting_mod ) ) );



	$icon  = '<span class="ab-icon"></span>';

	$title = '<span id="ab-awaiting-mod" class="ab-label awaiting-mod pending-count count-' . $awaiting_mod . '">' . number_format_i18n( $awaiting_mod ) . '</span>';



	$wp_admin_bar->add_menu( array(

		'id'    => 'comments',

		'title' => $icon . $title,

		'href'  => admin_url('edit-comments.php'),

		'meta'  => array( 'title' => $awaiting_title ),

	) );

}

10579

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: