Is it possible to make wp insert last comment onto another page

If we set wp to break comments into pages after X nr of comments and we have X+1 comments , wp only shows that last comment instead of showing X and move the comment from bottom onto the next page. Any help would be appreciated since it is a big deal for what I am trying to use it.

Related posts

3 comments

  1. ok.. so I did it like this. Maybe will help some. Used the code from Last comment page first with full number of comments? but altered it a bit to fit my needs. So this goes into your template page where you call the comments (or you can wrap it in a function and put it into functions.php)

     <?php comments_template( '', true ); ?>
     <?php 
     $comments_to_display = get_comments(array('post_id' => get_the_ID()));
     $comments_per_page = 10; // MAYBE: use get_option()?
     $comment_page = get_query_var( 'cpage' );
     $comment_this_page_start = 0;
     $comment_this_page_count = $comments_per_page;
     $oldest_comment_page_count = count( $comments_to_display ) % $comments_per_page;
     if ( 0 == $oldest_comment_page_count ) {
     $oldest_comment_page_count = $comments_per_page;
     }
     if ( 1 == $comment_page ) {
    $comment_this_page_count = $oldest_comment_page_count;
     } else {
    $comment_this_page_start = $oldest_comment_page_count + ($comment_page - 2) * 
    $comments_per_page;
    }
    $comments_to_display = array_slice( $comments_to_display, $comment_this_page_start,  
    $comment_this_page_count );
    
    wp_list_comments(array('style' => 'div'), $comments_to_display); ?>
    

    You are now ready to rock and roll!

    Later that day:

    I tried to use this method with the ajax comment loading plugin and did not work like I wanted; I got rid of it for the moment. ( there’s a problem with a parameter; basically if you set $comments_per_page to 10 it displays the first 10 comments of the day, then waits for the comments to reach to 20 in order to show the next 10.. then waits for comments to get to 30 to display the comments from 20 to 30. The issue seems to be simple and maybe someone will fix it in the future.)

    So returning to my the solution I’ve added the following:

     $comments = array_reverse($comments);
    

    in comments.php (theme dir), unchecked break comments into pages in admin panel and added:

     'per_page' => '100'  
    

    as a paramater to wp_list_comments().

    Now I always have the most recent 100 comments displayed without beggining a new page everytime the comment mark reaches to 101.

    It simply pushes the older comment onto the next page and adds the newer at the top!
    It is more simple and less headache so I recommend the second solution!

  2. In wp-admin, go to Settings -> Discussion -> Break comments into pages with X top level comments per page and the FIRST page displayed by default.

    If you pick the first page displayed by default make sure the drop-down underneath is set to OLDER comments at the top of each page.

Comments are closed.