Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 ) : ?>

or

<?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')) ?>
  </span>
 <div class="text">
      <?php comment_text() ?>
  </div>
  </div>
  <?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']))) ?>
  </div>
 </div>

And here's my comment.php: pastebin

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

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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

wp_list_comments('callback=mytheme_comment');

To this:

wp_list_comments(array(
  'callback'=>'mytheme_comment',
  'style'=>'ol',
));

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

wp_list_comments(array(
  'callback'=>'mytheme_comment',
  'style'=>'ol',
  'type'=>'comment',
));

wp_list_comments(array(
  'callback'=>'mytheme_comment',
  'style'=>'ol',
  'type'=>'pings',
));
share|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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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