Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save streetcoder/65bfbaea8fe0ee293b0d to your computer and use it in GitHub Desktop.
Save streetcoder/65bfbaea8fe0ee293b0d to your computer and use it in GitHub Desktop.
// this code should underneat of loop
<?php
global $wp_query;
$big = 999999999; // need an unlikely integer
$pages = 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,
'type' => 'array',
) );
?>
<nav>
<ul class="pagination">
<?php
foreach($pages as $page){
echo '<li>' . $page . '</li>';
}
?>
</ul>
</nav>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment