Viewing 2 replies - 1 through 2 (of 2 total)
  • There is a function in wordpress called paginate_links() is used to do this.

    And here is the code I use on my blog to display page numbers.

    <?php
    global $wp_query;
    $total = $wp_query->max_num_pages;
    if ( $total > 1 )  {
    echo "<div id=\"pagination\">";
    if(!$current_page = get_query_var('paged'))
    $current_page = 1;
    $perma = get_option('permalink_structure');
    $format = empty( $perma ) ? '&page=%#%' : 'page/%#%/';
    echo paginate_links(array(
    'base' => get_pagenum_link(1) . '%_%',
    'format' => $format,
    'current' => $current_page,
    'total' => $total,
    'end_size' => 2,
    'mid_size' => 1,
    'type' => 'list'
    ));
    echo "</div>";
    }
    ?>
    Thread Starter berius

    (@berius)

    thx jesin

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Posts/Comments page counter’ is closed to new replies.