Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Comments Pagination -Move comments to WordPress

  • SOLVED

Some of my posts have hundreds of comments. I have this "Break comments into pages with 50 top level comments per page and the last page displayed by default" selected.

Everything's good when there's under 50 comments but when the 51st comment comes, all comments before it are moved to "Older Comments" page so there's now only one comment showing.

I would like to change it so that when there's more than 50 comments, they are moved one-by-one to the "Older Comments" pages, so the post page would always show 50 latests comments.

I found a plugin ( http://winkpress.com/articles/fix-reversed-comments-pagination/ ) that does just this but with just one problem.

With this pluging you are only able to choose "Comments should be displayed with NEWER comments at the top of the page."

So if somebody is able to modify that plugin so that I can display newer comments at the end of the page, that would be great!

( If you can solve my problem without using that plugin, it's OK also. I just thought it would probably be easiest to solve this problem by just modifying that plugin. )

Answers (6)

2011-11-26

Manoj Raj answers:

Whats the wordpress version are you using? I really can't understand your problem. Anyway i assume that you want to display 50 comments at the landing page of an article. (And that should be ordered from older to newer comments). Right?

Why don't you set the discussion settings this way?

Break comments into pages with top level comments <strong>50</strong> per page and the <strong>first</strong> page displayed by default .
Comments should be displayed with the <strong>older </strong>comments at the top of each page

In this way the landing page always show oldest 50 comments. And the newer ones will be added in the subsequent pages..


HarriL comments:

Yeah but I would like to show 50 newest comments. They are in my case usually more relevant than the older ones.


HarriL comments:

Oh and the wordpress is: 3.2.1

So basicly I would like to break comments into pages with 50 top level comments per page..
And always show 50 latest comments on the landing page, Newest being at the end.


Manoj Raj comments:

Hi Harril,

Check the following url. I have numbered the comments

http://comnedy.com/wpquest/2011/08/01/hello-world/

Is this the way you want the comments to appear?

The newest at the bottom. Right?


HarriL comments:

Yeah I think that's what I'm looking for. How did you do it?


Manoj Raj comments:

Here is the solution

I have used the plugin you provided. In addition I have used jQuery order reverser plugin written by Corey H Maass.

First thing - Edit comments.php

search for <ol class="commentlist"> (as in twentyeleven theme)

add an id so that it becomes <ol id="reverseorder" class="commentlist">

include the jquery http://lab.arc90.com/tools/jquery_reverseorder/jquery.reverseorder.js in your header.php file

and add

<script type="text/javascript">
$(document).ready(function () {
$('ol#reverseorder li').reverseOrder();
});
</script>

in your header.php


HarriL comments:

Great. I'll have to head out but I'll be back within a couple of hours and will test it then and then reward you with the money. Thanks.


Manoj Raj comments:

Ya sure.


HarriL comments:

Excellent. It's working.

2011-11-26

Charles Klycinski answers:

Can You send me a PM or write here Your webiste address ? I will look into it.

2011-11-26

Hardeep Singh answers:

Please share the site address and do you need threaded view too?

2011-11-27

Christianto answers:

<blockquote>With this pluging you are only able to choose "Comments should be displayed with NEWER comments at the top of the page."</blockquote>

Hi,

I check the plugin and try it on my local installation with newest wordpress version, comments could be displayed with older comments at the top of the page so the newest comment are displayed at the bottom of the page...

There is setting on settings -> discussion settings to change what to be displayed on top of the page (newer/older comment), right below ""Break comments into pages with 50 top level comments per page and the last page displayed by default."

You can change the setting, no need to edit the plugin..
Hope this help..


Christianto comments:

Very strange...

why on my wp local installation the comment can be easily sort from newer to older at top of page...
The developer said it couldn't.. :D

What wordpress version that you use?

2011-11-27

Erez S answers:

As you can see here:
http://codex.wordpress.org/Settings_Discussion_SubPanel
You can change the order of comments as like Chrisitiano said.
If you can't see that option then try to upgrade your wordpress to the latest version.

Anyway you can also do that using the wp_list_comments function. if you will attach here your comments.php I'll be able to help you more, but this is something like that:

<?php
$args = array(
'per_page' => 50,
'reverse_top_level' => false
);
wp_list_comments( $args );
?>


HarriL comments:

Read the plugin page closely so you'll really understand my problem.
http://winkpress.com/articles/fix-reversed-comments-pagination/

So let's say you have a post with 6 comments. comment number 1 being the oldest and 6 the newest.

Now you break comments into pages with 5 comments per page.
Now on the main post page you should now have 1 comment showing. Newest one, comment number 6. Then there's "older comments" link and clicking it shows you the 5 older comments.

What I would like is that on the main post page there's 5 NEWEST comments showing. Newest at the end. So main post page would show comments 2-6 and clicking "Older comments" gives you comment number 1.

If you get comment number 7, now you would have main post page showing comments 3-7 and comments one and two are in the "Older Comments" page.

2011-11-27

Utkarsh Kukreti answers:

So if you have 7 comments (like in the example above), you want them to show up in this order?

Main page:
3
4
5
6
7 -> newest comment
Second page
1 -> oldest comment
2

or

Main Page
7
6
5
4
3
Second page
2
1