Return to Snippet

Revision: 61276
at December 4, 2012 00:22 by rudwolf


Initial Code
// put it in your functions.php of your theme, enjoy :)

function show_pagination_links()
{
    global $wp_query;

    $page_tot   = $wp_query->max_num_pages;
    $page_cur   = get_query_var( 'paged' );
    $big        = 999999999;

    if ( $page_tot == 1 ) return;

    echo paginate_links( array(
            'base'      => str_replace( $big, '%#%', get_pagenum_link( $big ) ), // need an unlikely integer cause the url can contains a number
            'format'    => '?paged=%#%',
            'current'   => max( 1, $page_cur ),
            'total'     => $page_tot,
            'prev_next' => true,
            'end_size'  => 1,
            'mid_size'  => 2,
            'type'      => 'list'
        )
    );
}

Initial URL

                                

Initial Description
Create navigation links without the need of a plugin, using paginate_links function of wordpress core.

Initial Title
Wordpress Native Pagination Links With Page Number No Plugin Needed

Initial Tags
number, wordpress, navigation, links

Initial Language
PHP