Skip to content

Instantly share code, notes, and snippets.

@dasbairagya
Created January 22, 2017 16:41
Show Gist options
  • Select an option

  • Save dasbairagya/2c5a4d41b53633af4fdf02a43a9f2c9b to your computer and use it in GitHub Desktop.

Select an option

Save dasbairagya/2c5a4d41b53633af4fdf02a43a9f2c9b to your computer and use it in GitHub Desktop.
paginate_links()
<?php $loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => get_option('to_count_portfolio'), 'paged' => get_query_var('paged') ? get_query_var('paged') : 1 )
); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<span class="title"><?php the_title(); ?></span></br>
<?php endwhile; ?>
<?php
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $loop->max_num_pages
) );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment