Created
April 15, 2013 12:36
-
-
Save gicolek/5387742 to your computer and use it in GitHub Desktop.
paginacj
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 | |
/** | |
* Generate the navigation for blog listing pages | |
* | |
* @global obj $wp_query | |
*/ | |
function bg_page_navi($query = null, $paged = null) { | |
?> | |
<ul class="page-navi"> | |
<?php | |
// for default query | |
if ( $query == null ) { | |
global $wp_query; | |
$query = $wp_query; | |
} | |
// for default query | |
if ( $paged == null ) { | |
$paged = get_query_var( 'paged' ); | |
} | |
$big = 999999999; // need an unlikely integer | |
echo paginate_links( array( | |
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), | |
'format' => '?paged=%#%', | |
'current' => max( 1, $paged ), | |
'total' => $query->max_num_pages | |
) ); | |
?> | |
</ul> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment