Archived topic
Pagination for Comments with Page Numbers in Generate Press
3 replies · Started by BHASKAR on February 11, 2021
We have a unique situation with thousands of comments on one of our sites that is using X theme.
Some pages have 2000 or more comments. We have paginated them in 100 pages per page using some code.
We want to move that to Generatepress. Would like to understand how to get the same pagination effect or page numbers with Generatepress theme. In fact, this is our key requirement to migrate.
Here is example : https://drive.google.com/file/d/1dige0uZnqpqmYxPCde-MVWPTM3ZMYCFr/view
Please suggest.
Hi there,
GP uses the standard WP Comments form.
To add pagination you would need to copy the comments.phpto a child theme:
https://github.com/tomusborne/generatepress/blob/master/comments.php
Then you’d replace this:
<div class="nav-previous"><?php previous_comments_link( __( '← Older Comments', 'generatepress' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments →', 'generatepress' ) ); ?></div>
With this:
<?php paginate_comments_links( array('prev_text' => '‹ Previous', 'next_text' => 'Next ›')); ?>
Hello,
Thanks for the reply. It worked.
Initially, I did a mistake only replacing it in one place and did not work.
Then, I replaced in two places, it worked.
Glad to hear that!