Site logo

Archived topic

How to show comment pagination

37 replies · Started by Benjamin on April 29, 2020

Viewing posts 1–15 of 38

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 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."

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( __( '&larr; Older Comments', 'generatepress' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'generatepress' ) ); ?></div>

With this:

<?php paginate_comments_links( array('prev_text' => '&lsaquo; Previous', 'next_text' => 'Next &rsaquo;')); ?>

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( __( '&larr; Older Comments', 'generatepress' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'generatepress' ) ); ?></div>

with this:

<?php paginate_comments_links( array('prev_text' => '&lsaquo; Previous', 'next_text' => 'Next &rsaquo;')); ?>

Hope this clarifies. :)

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?

This archived topic is closed to new replies.