the_comments_pagination()WP 4.4.0

Displays a paginated navigation to next/previous set of comments, when applicable.

No Hooks.

Return

null. Nothing (null).

Usage

the_comments_pagination( $args );
$args(array)
See get_the_comments_pagination() for available arguments.
Default: empty array

Examples

0

#1 Output pagination of comments posts (demo)

Let's assume that the post has 300 comments. The setting is to output 100 per page. Let's display pagination links:

<?php the_comments_pagination(); ?>

As a result, this code will output:

<nav class="navigation comments-pagination" role="navigation">

	<h2 class="screen-reader-text">Comments Navigation</h2>

	<div class="nav-links">
		<a class="prev page-numbers" href="http://example.com/postname/comment-page-1/#comments">← Earlier</a>
		<a class="page-numbers" href="http://example.com/postname/comment-page-1/#comments">1</a>
		<span class="page-numbers current">2</span>
		<a class="page-numbers" href="http://example.com/postname/comment-page-3/#comments">3</a>
		<a class="next page-numbers" href="http://example.com/postname/comment-page-3/#comments">Further →</a>
	</div>

</nav>

Changelog

Since 4.4.0 Introduced.

the_comments_pagination() code WP 6.4.3

function the_comments_pagination( $args = array() ) {
	echo get_the_comments_pagination( $args );
}