How to add pagination to comments?

I am using wp_list_comments(); function to list all the comments, but I want to add some pagination, for example 10 on o

I am using wp_list_comments(); function to list all the comments, but I want to add some pagination, for example 10 on one page.

I tried "Break comments into pages..." in Discussion panel but it sorts them werid...

Also I have added paginate_comments_links() but it doesn't work

I am using wp_list_comments(); function to list all the comments, but I want to add some pagination, for example 10 on one page.

I tried "Break comments into pages..." in Discussion panel but it sorts them werid...

Also I have added paginate_comments_links() but it doesn't work

Share Improve this question asked Sep 20, 2016 at 11:12 DavidDavid 872 silver badges15 bronze badges 2
  • Hi David.. Without a shadow of doubt my part, this question will get either put on hold, downvoted or flagged in some other way. I'm going to give you alink to read about how WPSE works, I found it very interesting, especially the answer from Rarst. meta.wordpress.stackexchange/questions/4275/… – Malisa Commented Sep 20, 2016 at 11:17
  • The codex already provide pagination args for comments? codex.wordpress/Function_Reference/wp_list_comments – Ahmed Fouad Commented Sep 20, 2016 at 12:03
Add a comment  | 

1 Answer 1

Reset to default 2

Put below code into your current theme's comments.php file:

<div class="navigation">
    <?php paginate_comments_links(); ?> 
</div>

<ol class="commentlist">
    <?php wp_list_comments(); ?>
</ol>

<div class="navigation">
    <?php paginate_comments_links(); ?> 
</div>

This code will display pagination as you expect. Don't forgot to check the break comment to part with number of settings from Admin > Settings > Discussion Settings. See below example snap.

I tested this code and this should work for you also. You can check more detail about paginate_comments_links here.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745048092a4608219.html

相关推荐

  • How to add pagination to comments?

    I am using wp_list_comments(); function to list all the comments, but I want to add some pagination, for example 10 on o

    7小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信