You can add the following to your functions.php file:
/* Pagination */ // Numbered Pagination if ( !function_exists( 'wpex_pagination' ) ) { function wpex_pagination() { $prev_arrow = is_rtl() ? 'Next <i class="fa fa-angle-right" aria-hidden="true"></i> ' : '<i class="fa fa-angle-left" aria-hidden="true"></i> Prev'; $next_arrow = is_rtl() ? '<i class="fa fa-angle-left" aria-hidden="true"></i> Prev ' : 'Next <i class="fa fa-angle-right" aria-hidden="true"></i> '; global $wp_query; $total = $wp_query->max_num_pages; $big = 999999999; // need an unlikely integer if( $total > 1 ) { if( !$current_page = get_query_var('paged') ) $current_page = 1; if( get_option('permalink_structure') ) { $format = 'page/%#%/'; } else { $format = '&paged=%#%'; } echo paginate_links(array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => $format, 'current' => max( 1, get_query_var('paged') ), 'total' => $total, 'mid_size' => 3, 'type' => 'list', 'prev_text' => $prev_arrow, 'next_text' => $next_arrow, )); } } } |
Then, in any archive file, add wpex_pagination() wherever you’d like the pagination to appear.