Skip to content

Instantly share code, notes, and snippets.

@daronspence
Created January 27, 2016 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daronspence/e2cc5e37e1d86fe122b2 to your computer and use it in GitHub Desktop.
Save daronspence/e2cc5e37e1d86fe122b2 to your computer and use it in GitHub Desktop.
WordPress Pagination Bar (1,2,3,4,...,87,88)
<?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