wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_admin_bar_comments_menu › WordPress Function

Seit3.1.0
Veraltetn/v
wp_admin_bar_comments_menu ( $wp_admin_bar )
Parameter:
  • (WP_Admin_Bar) $wp_admin_bar The WP_Admin_Bar instance.
    Erforderlich: Ja
Definiert in:
Codex:

Adds edit comments link with awaiting moderation count bubble.



Quellcode

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_text = sprintf(
		/* translators: Hidden accessibility text. %s: Number of comments. */
		_n( '%s Comment in moderation', '%s Comments in moderation', $awaiting_mod ),
		number_format_i18n( $awaiting_mod )
	);

	$icon   = '<span class="ab-icon" aria-hidden="true"></span>';
	$title  = '<span class="ab-label awaiting-mod pending-count count-' . $awaiting_mod . '" aria-hidden="true">' . number_format_i18n( $awaiting_mod ) . '</span>';
	$title .= '<span class="screen-reader-text comments-in-moderation-text">' . $awaiting_text . '</span>';

	$wp_admin_bar->add_node(
		array(
			'id'    => 'comments',
			'title' => $icon . $title,
			'href'  => admin_url( 'edit-comments.php' ),
		)
	);
}