Add “last” and “first” to WordPress Comment Pagination Links

<?php paginate_comments_links(array('prev_text' => '«', 'next_text' => '»')); ?>

Using above in WordPress theme to add comment pagination links – this displays as

« 1 … 4 5 6

“1” being the first page of comments and “6” being the last. I’d like to get something like this…

(first) « 1 2 3 » (last)

1 Answer
1

The number for the first page is always 1. The number of maximum pages can be set to $max_page by calling get_comment_pages_count():

 $max_page = get_comment_pages_count();

Probably this information helps on how to build links on top of that, which depends a bit on the style of your theme. For building links, I could not find any suitable function in the Worpdress API so far, the most promising seems paginate_links() to me.

Leave a Comment