Created
May 22, 2013 16:33
-
-
Save jmcclellan/5628979 to your computer and use it in GitHub Desktop.
Wordpress Paginate Links
This file contains hidden or 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 | |
// Default arguments | |
$args = array( | |
'base' => '%_%', | |
'format' => '?page=%#%', | |
'total' => 1, | |
'current' => 0, | |
'show_all' => False, | |
'end_size' => 1, | |
'mid_size' => 2, | |
'prev_next' => True, | |
'prev_text' => __('« Previous'), | |
'next_text' => __('Next »'), | |
'type' => 'plain', | |
'add_args' => False, | |
'add_fragment' => '' | |
); | |
// Example Use | |
global $wp_query; | |
$big = 999999999; // need an unlikely integer | |
echo paginate_links( array( | |
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), | |
'format' => '?paged=%#%', | |
'current' => max( 1, get_query_var('paged') ), | |
'total' => $wp_query->max_num_pages | |
) ); | |
// Credit & Further Reading | |
http://codex.wordpress.org/Function_Reference/paginate_links | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment