• I’ve setup my comments so that they show up in descending order. The issue I’m having is with the comment numbers for each comment within the entry.

    I’m using the <?php echo $relax_comment_count; ?> tag.

    https://www.krissy.nu/?p=14#comments

    If you look there, you’ll see Jenny all the way on the bottom, now even though she was the first to comment she’s reading as #14 (maybe changed by now).

    Is there a way to get it so that she shows up as #1 again? This way it reads #14-#1 instead of #1-#14?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Well, I’d do something like this:

    <?php
    /* before the comments loop */
    $comment_number = count ( $comments );
    ?>

    That will load up $comment_number with the number of comments for that entry. Also, $comment_number is the number you want given to the first comment (technically the most recent comment, but the comment that is SHOWN first).

    Now, within each comment loop iteration, you’ll want to print out this number, and then reduce it by one.

    <?php
    /* within the comment loop */
    echo "This is comment number: " . $comment_number;
    /* now that we're done with this comment, it is time to set up the number for the next comment... that is... make the number one lower */
    $comment_number--; // this decreases it by one
    ?>

    Now, the next time the comment loop runs (i.e. the next comment), $comment_number will be one lower. So in the case that you showed with 14 comments, you first get 14 (number of comments) and then each comment after that in the listing will get a number one lower. (13, 12, 11, 10 … 3, 2, 1)

    Sound good?

    Thread Starter Krissy

    (@krissy)

    That worked great, thank you so much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Desc Comments Numbers?’ is closed to new replies.