• I’ve seen this done on many blogs, and it would seemingly be a simple question, but is there a way to get the running tally number to put inside the comments loop so each one is labeled with an incrementing number? I don’t want to use the comment ID number, but just a regular 1, 2, 3 type thing.
    By default, the template uses an

      which I don’t want to do for design/semantic reasons, but rather I plan on using <dl>‘s. The output I’m looking for would be something like what can be seen at the bottom of my template at: https://elasticdog.com/ for the links to each comment.

    Viewing 5 replies - 1 through 5 (of 5 total)
    • Hm, if someone figured this out, it could be applied to post id’s, as well. Thus, keeping your archives better.
      (Example: I tested posts about 14 times before I got the blog running; my entry id’s are skewed.)

      Thread Starter elasticdog

      (@elasticdog)

      I figured out a solution for myself, although it’s not perfect for a few reasons…
      Right after if ($comments) { in wp-comments.php, I initialized a variable count and assigned it a value of 1:
      $count = 1;
      Then, in the comments loop, I used <?php echo "$count"; ?> where I needed it, and at the end of the comments loop, just put:
      $count++;
      I’m using the count variable not only to display a running tally on the page, but to make the id and hyperlink to the individual comment. The downside to this is if you delete a comment, the numbers for the comments after the deleted one will change. This really only effects spam messages and such, and would cause problems if someone had already grabbed the link location for a comment posted after one you got rid of.
      I thought it would be an okay tradeoff considering the links themselves won’t get used too often, and I’ll probably filter out the spam well before the time they actually do get linked to. I’d much rather have a link be logical and point to article/#comment3 if it’s the third comment on an individual article, rather than using the comment_id() and ending up with a link like: article/#comment4628 for the third comment on the page.

      Thread Starter elasticdog

      (@elasticdog)

      Ohh, and benjamin, re-ordering the entry IDs would have more of an impact, especially if you aren’t using cruft-free urls for your permalinks. If you really want to get rid of those first few IDs, since you were just testing things out, you can edit the database with phpAdmin.
      Also, if anyone would like to see the comments output so far, my work-in-progress can be seen at https://elasticdog.com/index.php

      I love the idea, thanks. I’ll just leave the entry id’s then, I’ve already set up proper permalinks.
      Besides, who does permalink to comments?

      There’s a glitch with some of the plug-ing, I’ve noticed as well. You can’t run the “Latest Comments” plug-in, as it requires the individual IDs.

    Viewing 5 replies - 1 through 5 (of 5 total)
    • The topic ‘Comment Number Tally’ is closed to new replies.