Created
June 5, 2014 18:55
-
-
Save andrewlaskey/01153ee1186ec6ec5a30 to your computer and use it in GitHub Desktop.
Page Navigation within Wordpress WP_Query
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 page_navi_in_query($query) { | |
$bignum = 999999999; | |
if ( $query->max_num_pages <= 1 ) | |
return; | |
echo '<nav class="pagination">'; | |
echo paginate_links( array( | |
'base' => str_replace( $bignum, '%#%', esc_url( get_pagenum_link($bignum) ) ), | |
'format' => '', | |
'current' => max( 1, get_query_var('paged') ), | |
'total' => $query->max_num_pages, | |
'prev_text' => '←', | |
'next_text' => '→', | |
'type' => 'list', | |
'end_size' => 3, | |
'mid_size' => 3 | |
) ); | |
echo '</nav>'; | |
} /* end page navi */ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment