Du musst dich anmelden um Beiträge und Themen zu erstellen. Einloggen · Registrieren

How to Number Your Comments, Pingbacks, & Trackbacks in 2.7+

Numbering comments, pingbacks, and trackbacks in WordPress versions 2.7 and greater requires two steps. First, you need to add a couple of parameters to your comments_template tag, which is used to display your comments template and normally located in your single.php file. Edit this tag so that it looks like this:

<?php comments_template('/comments.php',true); ?>

Once this is in place, you can display the number of your comments, pingbacks, trackbacks, and both using the following tags:

echo count($wp_query->comments_by_type['comment']); // display comment count
echo count($wp_query->comments_by_type['pingback']); // display pingback count
echo count($wp_query->comments_by_type['trackback']); // display trackback count

echo count($wp_query->comments_by_type['pings']); // display pingback and trackback count

comments_number('No Responses', 'One Response', '% Responses' ); // display total response count

These tags can be placed anywhere in your comments loop. For more information on how to implement this, check out our in-depth article at Digging into WordPress.