WordPress.org

Ready to get started?Download WordPress

Forums

query_posts pagination with offset problem (3 posts)

  1. Annie Boccio
    Member
    Posted 4 years ago #

    I'm trying to use query_posts om my front page to skip the most recent post (which appears in a feature box) but also include pagination.

    This is the original code, which breaks pagination:

    <?php
    $limit = 4;
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('showposts=' . $limit . '&paged=' . $paged .'&offset=1&cat=');
    $wp_query->is_archive = true; $wp_query->is_home = false;
    ?>

    I've replaced that with this (found at http://wordpress.org/support/topic/57912?replies=9) which fixes the pagination issue.

    <?php
    if (is_home()) {
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("paged=$paged");
    }
    ?>

    But now I'd like to add back in the offset=1 parameter

    <?php
    if (is_home()) {
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("offset=1&paged=$paged");
    }
    ?>

    and pagination breaks again. Is there another way to add in the offset?

  2. stvwlf
    Member
    Posted 4 years ago #

    Hi

    Here's the article on offsets and paging
    http://weblogtoolscollection.com/archives/2008/06/19/how-to-offsets-and-paging/
    See if you can work it out - ask questions if necessary

  3. Annie Boccio
    Member
    Posted 4 years ago #

    Thanks, that article was just what I needed, got it working!

Topic Closed

This topic has been closed to new replies.

About this Topic