Last Updated: February 25, 2016
·
1.422K
· rajeshkhatri13

Numbered Pagination on wordpress

paste in function.php


global $wpquery;
$big = 12345678;
$pageformat = paginatelinks( array(
    'base' => strreplace( $big, '%#%', escurl( getpagenumlink( $big ) ) ),
    'format' => '?paged=%#%',
    'current' => max( 1, getqueryvar('paged') ),
    'total' => $wpquery->maxnumpages,
    'type'  => 'array'
) );
if( isarray($pageformat) ) {
            $paged = ( getqueryvar('paged') == 0 ) ? 1 : getqueryvar('paged');
            echo '<div><ul>';
            echo '<li><span>'. $paged . ' of ' . $wpquery->maxnumpages .'</span></li>';
            foreach ($pageformat as $page) {
                    echo "<li>$page</li>";
            }
           echo '</ul<</div<';
}
}
</code></pre>

paste in template file


<div class="pagination"><?php wp_pagination(); ?></div>
</code></pre>