WordPress.org

Support

Support » Themes and Templates » Reverse comment numbering

Reverse comment numbering

  • 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!

Viewing 1 replies (of 1 total)
  • Got the solution:

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

Viewing 1 replies (of 1 total)
  • The topic ‘Reverse comment numbering’ is closed to new replies.
Skip to toolbar