Last active
May 11, 2017 12:57
-
-
Save brendonexus/28468f1234cb4fc6f213d23cde4dcbf2 to your computer and use it in GitHub Desktop.
Wordpress Pagination Function
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
function your_custom_pagination() { | |
global $wp_query; | |
$total = $wp_query->max_num_pages; | |
if ( $total > 1 ) { | |
if ( !$current_page = get_query_var('paged') ) { | |
$current_page = 1; | |
} | |
echo paginate_links(array( | |
'base' => get_pagenum_link(1) . '%_%', | |
'format' => '?paged=%#%', | |
'current' => $current_page, | |
'total' => $total, | |
'mid_size' => 4, | |
'type' => 'list' | |
)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment