WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the index.php page, I need to skip 5 posts (the last 5 posts in the blog).

I use the WP-Paginate plugin, but all pages show the same. I'm using offset=5, this is my code:

<?php  $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;?>
<?php   $additional_loop = new WP_Query("offset=5&paged=".$paged);  
        if ($additional_loop->have_posts()) :

        while ($additional_loop->have_posts()) : $additional_loop->the_post();
        <?php the_content();?>
        <?php endwhile;endif;?>
        <?php if(function_exists('wp_paginate')) {
} ?>
share|improve this question
Give this one a try: github.com/franz-josef-kaiser/Easy-Pagination-Deamon It can be used as plugin, but is meant to show you how pagination can be done in wp. – kaiser Mar 28 '11 at 5:45
You cannot use an offset with the paged parameter, the paging system sets the offset, when you set an offset you mess up the paging. If you use an offset you must create your own paging system(ie. build paging links yourself). – t31os Mar 28 '11 at 10:56

You can specify either paged for simple pagination, or offset if you want to do something special. Calculating the offset yourself is easy: just multiply the current page number (minus two) with the number of posts per page, and add your start offset:

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$posts_per_page = get_option( 'posts_per_page' ),
$additional_loop = new WP_Query( array(
    'offset' => ( $paged - 2 ) * $posts_per_page + 5,
) );

I see you use wp_paginate(), but this function does not know you are using an additional query and will read the global $wp_query object to get the current page and total number of pages, unless you pass these values yourself:

wp_paginate( array(
    'range' => 4,
    'anchor' => 2,
    'nextpage' => 'Next',
    'previouspage' => 'Previous',
    'page' => $paged,
    'pages' => intval( ceil( $additional_loop->found_posts / $posts_per_page ) ),
) );

This is an additional loop, so there still is a "normal" loop on this page? Watch out that this will not confuse pagination, because WordPress will also try to paginate that loop and return a 404 if it is exhausted - which may be before you reach the last page. Try to do pagination only in the main loop, with the pre_get_posts hook.

share|improve this answer

Your Answer


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.