Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Below is my pagination code. It can be seen in action at this link. When I start on page one it displays the first 3 pages and page 9 (the last page). When I go to the second it displays the first 4 and page 9. I find this to be odd behavior and expect the numbers to be added in a traditional behavior, like that code found on CSS tricks. Does anybody know what I've done incorrectly in my code below?

 // the block for pagination
        global $wp_query;
        $big = 999999999; // need an unlikely integer
        echo paginate_links(
            array(
                'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
                'format' => '?paged=%#%',
                'current' => max( 1, get_query_var('paged') ), 
                'total' => $wp_query->max_num_pages
            )
        ); 
share|improve this question
    
Did you get this from a specific article, if so can you please name it and link to it? –  Joe Izzard Dec 24 '12 at 23:29
add comment

1 Answer

up vote 1 down vote accepted

What you are seeing, I believe, is a result of paginate_links using three blocks of numbering-- first, middle, and last. If you had enough pages you'd get, for example, when browsing page 50 ...

1 2 3 ... 49 50 51 ... 98 99 100

If you imagine the "middle" numbers overlapping the "first" numbers you'd get 3 or 4 or five numbers bunched up. You can play with the end_size and mid_size parameters and try to get something you like better, or use 'type' => 'array' and write your own display function to convert the resulting array into actual pagination links.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.