Created
January 22, 2017 16:41
-
-
Save dasbairagya/2c5a4d41b53633af4fdf02a43a9f2c9b to your computer and use it in GitHub Desktop.
paginate_links()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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