Hi Trevor,
Here is an example of the pagination code we have:
Within our index.php page:
// Previous/next page navigation.
the_posts_pagination( array(
'mid_size' => 2,
'prev_text' => __( 'Previous page', 'twentysixteen' ),
'next_text' => __( 'Next page', 'twentysixteen' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentysixteen' ) . ' </span>',
) );
Within link-template.php:
function get_the_posts_pagination( $args = array() ) {
$navigation = '';
// Don't print empty markup if there's only one page.
if ( $GLOBALS['wp_query']->max_num_pages > 1 ) {
$args = wp_parse_args( $args, array(
'mid_size' => 1,
'prev_text' => _x( 'Previous', 'previous post' ),
'next_text' => _x( 'Next', 'next post' ),
'screen_reader_text' => __( 'Posts navigation' ),
) );
// Make sure we get a string back. Plain is the next best thing.
if ( isset( $args['type'] ) && 'array' == $args['type'] ) {
$args['type'] = 'plain';
}
// Set up paginated links.
$links = paginate_links( $args );
if ( $links ) {
$navigation = _navigation_markup( $links, 'pagination', $args['screen_reader_text'] );
}
}
return $navigation;
}
/**
* Display a paginated navigation to next/previous set of posts,
* when applicable.
*
* @since 4.1.0
*
* @param array $args Optional. See {@see get_the_posts_pagination()} for available arguments.
* Default empty array.
*/
function the_posts_pagination( $args = array() ) {
echo get_the_posts_pagination( $args );
}