Last active
August 29, 2015 14:07
-
-
Save cameronbaney/e199801cdb14d58f46b5 to your computer and use it in GitHub Desktop.
WordPress Pagination
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 | |
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; | |
$query = new WP_Query(array('post_type'=>$type,'posts_per_page'=>'5','orderby'=>'date','order'=>'DESC','paged'=>$paged)); | |
?> | |
<div class="pagination"> | |
<?php | |
$big = 999999999; | |
echo paginate_links( array( | |
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), | |
'format' => '?paged=%#%', | |
'current' => max( 1, get_query_var('paged') ), | |
'total' => $query->max_num_pages, // Make sure the variable is the same as the WP_Query Variable | |
'show_all' => False, | |
'end_size' => 1, | |
'mid_size' => 2, | |
'prev_next' => True, | |
'prev_text' => __('<i class="icon-arw-left"></i>'), | |
'next_text' => __('<i class="icon-arw-right"></i>'), | |
'type' => 'plain', | |
'add_args' => False, | |
'add_fragment' => '', | |
'before_page_number' => '', | |
'after_page_number' => '' | |
) ); | |
?> | |
</div> |
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 | |
$big = 999999999; | |
global $wp_query; | |
echo 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, | |
'show_all' => False, | |
'end_size' => 1, | |
'mid_size' => 2, | |
'prev_next' => True, | |
'prev_text' => __('<i class="icon-arw-left"></i>'), | |
'next_text' => __('<i class="icon-arw-right"></i>'), | |
'type' => 'plain', | |
'add_args' => False, | |
'add_fragment' => '', | |
'before_page_number' => '', | |
'after_page_number' => '' | |
) ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment