I've been googling around for tutorials of how to a) number the comments in the comment list and b) seperate trackbacks/pings from the rest of your comments.

All the tutorials seem to be out of date?! They all suggest you look for something in your comment.php file that I haven't seen in any newer theme lately, namely:

<?php if ( $comments ) : ?>


<?php foreach ($comments as $comment) : ?>

I don't seem to have anything like that in my comment.php. I also checked the comment.template and comment.php in the wp-includes folder, but couldn't find anything. Also no luck looking through the function.php.

Here's the comment-related snipped of my function.php:

function mytheme_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class('clearfix'); ?> id="li-comment-<?php comment_ID() ?>">
 <?php echo get_avatar($comment,$size='63'); ?>
 <div id="comment-<?php comment_ID(); ?>">
  <div class="comment-meta commentmetadata clearfix">
    <?php printf(__('<strong>%s</strong>'), get_comment_author_link()) ?><?php edit_comment_link(__('<img src="http://www.zoomingjapan.com/wp-content/themes/alltuts/images/edit.gif">'),'  ','') ?> <span><?php printf(__('%1$s @ %2$s'), get_comment_date('Y/n/j'),  get_comment_time('G:i')) ?>
 <div class="text">
      <?php comment_text() ?>
  <?php if ($comment->comment_approved == '0') : ?>
     <em><?php _e('Your comment is awaiting moderation.') ?></em>
     <br />
  <?php endif; ?>

  <div class="reply">
     <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

And here's my comment.php: pastebin

I'd really appreciate your advice. Thanks a lot.


For numbering, in your comment.php, change this:


To this:


For separation into comments and pingbacks, you'd do something like this:


| improve this answer | |
  • Awesome! Thank you. Now the pingbacks are seperate :) However, the comments still don't seem to be numbered. Do I have to add anything in addition to that? (You can also check it live at my website: zoomingjapan dot com Thanks again! :) – japanworm Sep 4 '11 at 16:09
  • 2
    You'll need to use CSS to make it display the numbering. – Otto Sep 5 '11 at 21:27
  • 1
    I tried the following code snippet to seperate pingbacks and comments because I wanted to have a headline for the Pingbacks: wpbeginner.com/wp-tutorials/… It didn't work, instead no comments/pingbacks at all showed up. With the code you provided, what do I have to do to get the comment numbers to show up, I tried ".commentnumber" but no effect, so I guess I have to create some divs for that first? Where would I put those, though?! Thanks again! – japanworm Sep 7 '11 at 2:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.