WordPress.org

Ready to get started?Download WordPress

Forums

Reverse comment numbering (2 posts)

  1. Hegarty
    Member
    Posted 3 years ago #

    Hello,

    in order to give every comment a number, my functions.php contains the following code:

    <?php global $comment_num;
    if(isset($comment_num)) {
    $comment_num++;
    } else { $comment_num = 1; }
    ?>

    How am I able to modify this code in order to reverse the numbering? The very last comment at the bottom of the page should become "Comment no.1".

    Thanks in advance for your help!

  2. Hegarty
    Member
    Posted 3 years ago #

    Got the solution:

    <?php global $comment_num;
    if(isset($comment_num)) {
    $comment_num--;
    } else { global $post; $comment_num = $post->comment_count; }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic