Archived topic
Remove duplicate comment pagination
11 replies · Started by Jesse on May 24, 2021
Hello,
The “older comments” and “newer comments” links appear twice; once at the top of the comments and again at the bottom of the comments. I only want them to show up at the bottom. How do I remove the links at the top (see screenshot)?
Best regards,
Jesse
Hi Jesse,
I don't see the older comments or newer comments link:
https://www.screencast.com/t/FGChVtMF
Do I have to log in to see them?
Hello,
I have cleared the cache. Please try again.
Best regards,
Jesse
I can see the links now, you can give this CSS a try:
#comment-nav-above {
display: none;
}
Is there a way to do it without CSS?
Do you mean customizer options? I don't think so.
Maybe with PHP snippet, but CSS is the simplest way.
Yes. I would love to be able to remove it from the site vs. hiding it with CSS so that it doesn’t create any additional DOM nodes.
There is currently no filter there so you will need to use a child theme, copy the comment.php file here and paste it in the child theme's folder:
https://github.com/tomusborne/generatepress/blob/master/comments.php
Then remove this section of the code:
https://github.com/tomusborne/generatepress/blob/master/comments.php#L81-L88
Hi Leo,
I’m already using this comments.php file in my child theme in order to move the comment form above comments: https://docs.generatepress.com/article/move-the-comment-form-above-comments/
When I removed that block of code from this comments.php file, it showed a message “There has been a critical error on this website.” in the area where the comments normally appear.
Best regards,
Jesse
Try adding: ?> in this line: https://github.com/tomusborne/generatepress/blob/master/comments.php#L89
That worked, thanks!
No problem :)