I would like to reverse the comment pagination numbers so that the newest comments show on page 1 instead of the last page. I did an array_reverse for the comments_array and set the WordPress Discussion Settings to first page displayed by default – everything works fine except when someone leaves a comment it doesn’t take in consideration the array_reverse and it takes the user to the link where the comment would be without the array reverse and obviously the comment is not there.

I noticed that the redirect comes from wp-comments-post.php

$location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id;

Is there a way to get the correct redirect link after a comment is submitted? Or is there a simpler way to get the comment pagination numbers reversed?
Thanks in advance!

2 Answers
2

i’ve used

wp_list_comments

like this:

<?php if (class_exists('Walker_Comment_Wink'))
    $walker = new Walker_Comment_Wink();
  else
    $walker="";

 wp_list_comments(array('walker' => $walker, 'type' => 'comment' , 'callback' => 'theme_comment2')); ?>

i used the plugin http://winkpress.com/articles/fix-reversed-comments-pagination/ to fix the “* and 1 comment” weirdness.

You have the option to pass

$reverse_top_level (boolean) (optional)
Setting this to true will display the most recent comment first then going back in order.
Default: null

you can check it in action here http://www.joaoleitao.com/viagens/acerca-do-autor/

Leave a Reply

Your email address will not be published. Required fields are marked *