Skip to content

Instantly share code, notes, and snippets.

@jarnesjo
Created February 10, 2014 12:11
Show Gist options
  • Save jarnesjo/8914796 to your computer and use it in GitHub Desktop.
Save jarnesjo/8914796 to your computer and use it in GitHub Desktop.
Create pagination with numbers in WordPress
<?php
// Pagniation
global $wp_query;
$big = 999999999; // need an unlikely integer
echo '<nav id="pagination" class="col-sm-12">';
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '/page/%#%',
'end_size' => 0,
'mid_size' => 4,
'type' => 'plain',
'current' => max( 1, get_query_var('paged') ),
'prev_text' => __('&laquo; Föregående', get_text_domain()),
'next_text' => __('Nästa &raquo;', get_text_domain()),
'total' => $wp_query->max_num_pages
) );
echo '</nav>';
?>
@sdaponte
Copy link

Line 2 comment // Pagination is spelled wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment