Pagination function in wordpress for posts

Jimmy Wales Reply 14:55
Put this code in functions.php file
<?php

if ( ! function_exists( 'wp_pagination' ) ) :
function wp_pagination() {
global $wp_query;

$int_val= 99999999; // need an unlikely integer

echo paginate_links( array(
'base' => str_replace( $int_val, '%#%', esc_url( get_pagenum_link( $int_val) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages
) );
}
endif;

?>

and put this code anywhere for pagination

<?php wp_pagination (); ?>
Copyright by GhostPHP. Powered by Blogger.

Search

Recent Post

Popular Posts

Follow us