Archived topic
How to show comment pagination
37 replies · Started by Benjamin on April 29, 2020
Hi,
I set my comments to be broken into pages with 10 comments per page. And when I go on the page, I can click on "Older Comments" to see the previous page.
But I would prefer to see pagination instead.
So instead of "Older Comments" and "newer comments", somply 1,2,3 etc
Is that possible with GeneratePress?
Thanks
Hi there,
The comment system is handled by WordPress itself.
Does this help?
https://www.wpbeginner.com/wp-tutorials/how-to-paginate-comments-in-wordpress/
Hi Leo,
Thanks for your reply.
Are you sure the way the pagination is not handled by GeneratePress though?
The article you linked to actually says "Depending on your theme’s styling, you will either see numeric pagination or ‘Previous / Next’ comment links."
My bad. That is indeed handled by GP.
You'd need to overwrite the entire comment.php file:
https://github.com/tomusborne/generatepress/blob/master/comments.php
I'll check with Tom on how to make them numbers. Sorry about that!
Hi there,
Yea, looks like you'll need to overwrite the entire file (add it to your child theme), unfortunately.
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 ›')); ?>
Let me know if that helps or not :)
Hello, Is this still the only way to enable number based pagination?
Thanks
Hi there,
yes that is still the only way to make that change.
Thank You David!
You're welcome
More details would be helpful. Just want to see 1, 2, 3, 4, ....etc on the bottom of the post / page for moving on to the next page of OLDER comments. No older or newer comments at the top and or bottom of the post and or page.
Thanks
PS....better idea of what IU am trying to achieve...see below
< << 1, 2, 3, 4, 5,...> >>
Hope that helps
Hi Mike,
I’ll try to enumerate the steps need to achieve this as mentioned above.
1. Use the Child theme: https://docs.generatepress.com/article/using-child-theme/
2. Create a comments.php file in the folder of the child theme.
3. Copy the contents of the original comments.php file to the new file you created: https://github.com/tomusborne/generatepress/blob/master/comments.php
4. 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 ›')); ?>
Hope this clarifies. :)
Sorry, does not work. Tried it twice, cleared cache., force browser refresh, tried different browsers, etc.
It has always been like that, even before the editing of the comments.php file. That is what I want to change.
What I want is something like this...just plain text, don't care about boxes and or colors.
https://nevis1.com/comments-style-01.jpg
< << 1, 2, 3, 4, 5,…> >>
Something like wp-pagenavi does for pages, but without a plugin..possible?