Skip to content

Instantly share code, notes, and snippets.

@alexmangini
Created April 21, 2014 05:33
Show Gist options
  • Save alexmangini/11133172 to your computer and use it in GitHub Desktop.
Save alexmangini/11133172 to your computer and use it in GitHub Desktop.
Pagination for CPTs
<?php // Pagination ?>
<?php
$big = 999999999;
$total = $kolfolio->max_num_pages;
$paginate = paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var( 'paged' ) ),
'prev_text' => __( '&larr; Previous', 'kol' ),
'next_text' => __( 'Next &rarr;', 'kol' ),
'total' => $total
) );
?>
<?php if ( $paginate ) : ?>
<div class="pagination">
<span class="pagination-total"><?php echo sprintf( __( 'Page %d of %2d', 'kol' ), $paged, $total ); ?></span>
<?php echo $paginate; ?>
</div>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment