Created
January 27, 2016 22:50
-
-
Save daronspence/e2cc5e37e1d86fe122b2 to your computer and use it in GitHub Desktop.
WordPress Pagination Bar (1,2,3,4,...,87,88)
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 | |
function pagination_bar() { | |
global $wp_query; | |
$total_pages = $wp_query->max_num_pages; | |
if ($total_pages > 1){ | |
$current_page = max(1, get_query_var('paged')); | |
echo paginate_links(array( | |
'base' => get_pagenum_link(1) . '%_%', | |
'format' => '/page/%#%', | |
'current' => $current_page, | |
'total' => $total_pages, | |
)); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment