• I have seen others with posts_per_page problems where going to older entries didn’t change what was showing. I have a similar problem with a twist. I am using an offset.

    <?php query_posts('posts_per_page=5&offset=5'); ?>

    I have seen this solution, but I don’t know how to integrate the offset into it.

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('posts_per_page=5&paged=' . $paged);
    ?>

    Can someone give me a hand, please?

Viewing 11 replies - 1 through 11 (of 11 total)
  • You can’t use an offset and the paged parameter, since they both control the same part of the query, it’s one or the other..

    Either let the paging system set the offset for you, or define your own offset, not both..

    Thread Starter geofffox

    (@geofffox)

    Hmmmm —

    Here’s what I’m trying to do. Since I’ve seen others do it successfully I just must be going about it the wrong way.

    I show full 5 posts then 5 excepts. To do that I run to separate loops–the second of which has the offset.

    Should I be using some sort of logic so both posts and excerpts are within the same loop, but the proper one will work ‘if’ the count is correct? That seems logical, though I’ll have to figure out exactly how to filter for that.

    Yes it would be easier to use one query.

    If you can post your complete code (from whichever file you’re doing this in), i’ll show you where to make changes.

    Please use a pastebin for posting code, and report the link back here.

    Thread Starter geofffox

    (@geofffox)

    But now you get to see what a poor coder I am! This is embarrassing.

    The month/day/year divs create a calendar badge with each entry.

    http://wordpress.pastebin.ca/1817587

    Thanks for your help.

    We all have to start somewhere, i’m just a coding hobbyist myself, all self taught, i’m by no means a guru, so no need to be embarassed.

    I’ll take a look at your code and post back shortly.. 😉

    What do you currently have set for “Blog pages show at most“, under Admin > Settings > Reading ..

    Thread Starter geofffox

    (@geofffox)

    10 posts.

    Here you go.
    http://wordpress.pastebin.ca/1817732

    See if that helps.. 🙂

    Thread Starter geofffox

    (@geofffox)

    On my way to work. Will report back late tonight. Thanks.

    Thread Starter geofffox

    (@geofffox)

    Thanks for the assist. It works perfectly. You’re my hero.

    Actually (and what a surprise on a WordPress forum) I blogged about it: http://www.geofffox.com/MT/archives/2010/03/02/we_are_driven_to_hack.php That’s the blog soon to be replaced by my shiny new WP blog!

    In short the solution to your problem was to just add a counter to your code that allowed us to conditionalise which set of elements would show when particular posts were being displayed, 1-5 one set, and all thereafter another set..

    I can relate to pretty much everything in your blog, i build my own PCs to (and cleanup PCs for friends etc).. 😉
    As fate would have it though, i’m actually using a laptop, the one computer in the house “not” built myself (also the slowest – makes a good test server)..

    Happy i could help .. 🙂

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘post_per_page – a little more complex’ is closed to new replies.