<?php
/**
* functions/inc-pagination.php
*
* Replace 'older/newer' post links with numbered navigation
*
* @author JJROD Framework
* @see https://docs.jjrod.com
* @version 1.0
*/
function joints_page_navi() {
global $wp_query;
$big = 999999999; // This needs to be an unlikely integer
// For more options and info view the docs for paginate_links()
// http://codex.wordpress.org/Function_Reference/paginate_links
$paginate_links = paginate_links( array(
'base' => str_replace( $big, '%#%', html_entity_decode( get_pagenum_link( $big ) ) ),
'current' => max( 1, get_query_var( 'paged' ) ),
'total' => $wp_query->max_num_pages,
'mid_size' => 5,
'prev_next' => true,
'prev_text' => __( '<span class="fas fa-chevron-left"></span>', 'jointswp' ),
'next_text' => __( '<span class="fas fa-chevron-right"></span>', 'jointswp' ),
'type' => 'list',
) );
$paginate_links = str_replace( "<ul class='page-numbers'>", "<ul class='pagination'>", $paginate_links );
$paginate_links = str_replace( '<li><span class="page-numbers dots">', "<li><a href='#'>", $paginate_links );
$paginate_links = str_replace( "<li><span class='page-numbers current'>", "<li class='current'>", $paginate_links );
$paginate_links = str_replace( '</span>', '</a>', $paginate_links );
$paginate_links = str_replace( "<li><a href='#'>…</a></li>", "<li><span class='dots'>…</span></li>", $paginate_links );
$paginate_links = preg_replace( '/\s*page-numbers/', '', $paginate_links );
// Display the pagination if more than one page is found.
if ( $paginate_links ) {
echo '<div class="page-navigation">';
echo $paginate_links;
echo '</div><!--// end .pagination -->';
}
}