Last active
September 29, 2018 10:27
-
-
Save mahdiyazdani/00241eaa4cc0c00c2704890744cad4fd to your computer and use it in GitHub Desktop.
Numeric WordPress Pagination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function prefix_paginate_links() { | |
global $wp_query; | |
$big = 999999999; // This needs to be an unlikely integer | |
$args = array( | |
'base' => str_replace( $big, '%#%', get_pagenum_link($big) ), | |
'format' => '?paged=%#%', | |
'total' => $wp_query->max_num_pages, | |
'current' => max( 1, get_query_var('paged') ), | |
'show_all' => FALSE, | |
'end_size' => 1, | |
'mid_size' => 2, | |
'prev_next' => TRUE, | |
'prev_text' => __( '« Previous', '@textDomain' ), | |
'next_text' => __( 'Next »', '@textDomain' ), | |
'type' => 'plain', | |
'add_args' => FALSE, | |
'add_fragment' => '', | |
'before_page_number' => '', | |
'after_page_number' => '' | |
); | |
printf( '<div class="prefix-archive-pagination">%1$s</div>', paginate_links( $args ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment