• Resolved utnalove

    (@utnalove)


    Hello, I would like to have a number for each comment, where also replies are numbered as if they were stand-alone comments and not replies.

    Eg:

    1) comment 1
    2) comment 2
    3) comment 3
    4) reply to comment 3
    5) reply to comment 3
    6) reply to reply to comment 3
    7) comment 4
    8) comment 5

    I saw there is a plugin that instead helps making the following numeration:

    1) comment 1
    2) comment 2
    3) comment 3
    3.1) reply to comment 3
    3.2) reply to comment 3
    3.3) reply to reply to comment 3
    4) comment 4
    5) comment 5

    I am interested in the first kind of comments numbering… is it possible to do that? How?

    Thank you

Viewing 12 replies - 16 through 27 (of 27 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Did you change this:

    <div class="navigation">
    		<div class="alignleft"><?php previous_comments_link() ?></div>
    		<div class="alignright"><?php next_comments_link() ?></div>
    	</div>
    
      <div class="commWrap png">
        <ol class="commentlist">
          <?php wp_list_comments('type=comment&avatar_size=64'); ?>
        </ol>
      </div>
      <div class="commFoot png"></div>

    to this:

    <div class="navigation">
    		<div class="alignleft"><?php previous_comments_link() ?></div>
    		<div class="alignright"><?php next_comments_link() ?></div>
    	</div>
    
      <div class="commWrap png">
        <ol class="commentlist">
          <?php wp_list_comments('type=comment&callback=mytheme_comment');  ?>
        </ol>
      </div>
      <div class="commFoot png"></div>

    Moderator keesiemeijer

    (@keesiemeijer)

    Try it with this in your functions.php.

    and change this:

    <?php wp_list_comments('type=comment&callback=mytheme_comment');  ?>

    to:

    <?php
    $mycomments = 0;
    global $mycomments;
    wp_list_comments('type=comment&callback=mytheme_comment');
    ?>

    Thread Starter utnalove

    (@utnalove)

    Sorry I lost myself…

    In the functions.php I have added the following code:

    function mytheme_comment($comment, $args, $depth) {
    	global $comment_thread_alt;
       $GLOBALS['comment'] = $comment; ?>
       <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
         <div id="comment-<?php comment_ID(); ?>">
          <div class="comment-author vcard">
             <?php echo get_avatar($comment,$size='64'); ?>
             <?php printf(__('<cite class="fn"><span class="commentnumber">%2$s</span> %1$s</cite> <span class="says">says:</span>'), get_comment_author_link(), $comment_thread_alt) ?>
          </div>
          <?php if ($comment->comment_approved == '0') : ?>
             <em><?php _e('Your comment is awaiting moderation.') ?></em>
             <br />
          <?php endif; ?>
    
          <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),'  ','') ?></div>
    
          <?php comment_text() ?>
    
          <div class="reply">
             <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
          </div>
         </div>
    <?php
            }

    Should I delete it and add in the functions.php this code?
    And then replace that line with those 3 lines?

    Thread Starter utnalove

    (@utnalove)

    And yes, in the comments.php I have this now:

    <div class="commWrap png">
        <ol class="commentlist">
          <?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>
        </ol>
      </div>

    And it works fine as you can see in the site

    Moderator keesiemeijer

    (@keesiemeijer)

    Should I delete it and add in the functions.php this code?

    yes

    And change what you have in the comments.php to:

    <div class="commWrap png">
        <ol class="commentlist">
          <?php
    $mycomments = 0;
    global $mycomments;
    wp_list_comments('type=comment&callback=mytheme_comment');
    ?>
        </ol>
      </div>

    Thread Starter utnalove

    (@utnalove)

    WONDERFUL!!!! It works!!!
    You are so helpful!! :)))

    Pity that there you can’t see my smile ^_^

    P.s. What should I add in order to have the number + bracket?

    Eg. now there is:

    1 name
    2 name
    3 name

    I would like to have

    1) name
    2) name
    3) name

    Moderator keesiemeijer

    (@keesiemeijer)

    in functions.php change this:

    <?php printf(__('<cite class="fn"><span class="commentnumber">%2$s</span> %1$s</cite> <span class="says">says:</span>'), get_comment_author_link(), $mycomments) ?>

    to this:

    <?php printf(__('<cite class="fn"><span class="commentnumber">%2$s)</span> %1$s</cite> <span class="says">says:</span>'), get_comment_author_link(), $mycomments) ?>

    Thread Starter utnalove

    (@utnalove)

    Outstanding… case resolved :))))

    Moderator keesiemeijer

    (@keesiemeijer)

    Can you still reply to comments?

    Thread Starter utnalove

    (@utnalove)

    it looks like I can… I tried to add a comment and to reply to a comment and it worked.

    The post with 800+ comments has commenting disabled by me.

    Moderator keesiemeijer

    (@keesiemeijer)

    Oh, thats why. Glad you got it resolved.

    Thread Starter utnalove

    (@utnalove)

    Thank you so much!! :))

Viewing 12 replies - 16 through 27 (of 27 total)
  • The topic ‘Numbered comments – how to?’ is closed to new replies.