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
1 Answer
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.