Support » Plugins » Show comment number in the new comment loop (WP 2.7 and after)

  • Hi everybody,

    One of the functions I used a lot was a custom WordPress comment loop to show comment number, which can be found, for example, here:

    Now, I’m adapting my theme to the new WordPress comment loop (with nested comments, comment pagination, etc.). I’ve already added my custom comment style in the functions.php file of my theme, but I can’t figure out how to use the counter too, it doesn’t seem to work.

    By the way, here’s my current comment code as it is defined in the functions.php file:

    // Loop de comentarios
    function mytheme_comment($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; ?>
    <?php $i++; ?>
    <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
    <div id="respond comment-<?php comment_ID(); ?>" class="br">
    <div class="comment-author vcard br">
    <?php echo get_avatar($comment,$size='48'); ?>
    <?php printf(('%s'), get_comment_author_link()); ?><br />
    <div class="commentmetadata">
    <?php comment_date('F j, Y'); ?> @ <?php comment_time(); ?>
    <?php if ($comment->comment_approved == '0') : ?>
    <p class="comment-moderation"><em>Tu comentario serĂ¡ revisado por un moderador.</em></p>
    <?php endif; ?>
    <div class="comment-text br">
    #<?php echo $i; ?>
    <?php comment_text(); ?>
    <div class="editar left">
    <?php edit_comment_link('Editar'); ?>
    <div class="reply right">
    <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
    <?php } // WP adds the closing </li>

    Anybody has figured out this already? I hope that someone knows a solution to this…

  • The topic ‘Show comment number in the new comment loop (WP 2.7 and after)’ is closed to new replies.