the_posts_navigation()WP 4.1.0

Displays the navigation to next/previous set of posts, when applicable.

No Hooks.

Return

null. Nothing (null).

Usage

the_posts_navigation( $args );
$args(array)
See get_the_posts_navigation() for available arguments.
Default: empty array

Examples

0

#1 Display links to the previous/next set of posts

the_posts_navigation( array(
	'prev_text' => 'Previous posts',
	'next_text' => 'Next posts',
	'screen_reader_text' => 'Navigation',
) );

As a result the following navigation code will be displayed:

<nav class="navigation posts-navigation" role="navigation">
	<h2 class="screen-reader-text">Navigation</h2>
	<div class="nav-links">
		<div class="nav-previous">
			<a href="http://example.com/page/3/">Previous posts</a>
		</div>
		<div class="nav-next">
			<a href="http://example.com/">The following posts</a>
		</div>
	</div>
</nav>

Changelog

Since 4.1.0 Introduced.

the_posts_navigation() code WP 6.4.3

function the_posts_navigation( $args = array() ) {
	echo get_the_posts_navigation( $args );
}