• jthomasc

    (@jthomasc)


    I would like to have the previous post links in my sidebar begin with the first post older than the oldest post on the page.

    Example: My home page displays excerpts of my five most recent posts then in my sidebar I would like the previous post list to begin with the first post older than the oldest excerpt shown and continue from there. Right now using the get archives post by post shows the same posts as the excerpts and not the ones that are actually previous.

    This logic should lend itself to full post pages as well since only one post is shown then the previous post links in the sidebar would begin with the first post that occured before the currently viewed post.

    Does anyone know of a method, code, or plugin that exists that might accomplish what I am talking about.

    I have implemented the previous ‘n’ post plugin but that only hides the latest post.

Viewing 10 replies - 1 through 10 (of 10 total)
  • rudolf45

    (@rudolf45)

    Not sure but maybe this template tag?
    http://codex.wordpress.org/Template_Tags/get_posts
    (it has an offset parameter)

    Thread Starter jthomasc

    (@jthomasc)

    I suppose that would do the trick for the home page, but it lacks the logic to make it a uniform solution. I would have to make two seperate sidebar files and leave the sidebar on inner pages listing the latest posts rather than the ones older than the currently viewed post.

    What about using is_home() to display it only on the front page?

    Thread Starter jthomasc

    (@jthomasc)

    I’ll look into that azaozz but I it sounds like that would only fix the double file issue, that still leaves the issue of making the previous post links fall in line on the inner pages.

    Thank you both for your input by the way.

    How about replacing the previous posts links with this?

    <ul>
     <?php
    if (is_home) {
     $myposts = get_posts('numberposts=5&offset=5');
     foreach($myposts as $post) : ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
     </ul>
    <?php } else { ?>
    <ul>
     <?php
     $myposts = get_posts('numberposts=5');
     foreach($myposts as $post) : ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
     </ul>
    <?php } ?>

    Thread Starter jthomasc

    (@jthomasc)

    That would work correctly on the home page but it would just show the five most recent posts on any other page.

    I am looking for something that would see the posts either the exerpt or a full post that is displayed and then identify either-which of those excerpts are the oldest and begin the list there or, if it is a single full post view begin the list with the post that came before that full post view.

    Make sense?

    Thanks,
    J.

    rudolf45

    (@rudolf45)

    Yes and no.
    I mean it makes sense – as in “it is clear what you want”.
    On the other hand it doesn’t because… let’s say I arrive to your single post written Nov 13, 2006 via a search engine. Great. When I finished reading I look around and I see links to 5 post written prior that date. Not interested. Period. Not to mention that usually on single post view there are links to the next/prev post.
    However, if I see the most recent 5 (i.e. those written today, yesterday etc.) I might want to see what are you up to these days.

    Maybe it’s just me. Maybe others think the same.

    I agree with rudolf45, but if you need to go further back from an old post, try setting the “offset” argument to the right number. Something like get all posts’ IDs in an array sorted by date, descending, find the position of the displayed post in that array and set the “offset” to that -1.

    Thread Starter jthomasc

    (@jthomasc)

    Rudolf45 I appreciate you sharing your opinion, I wish it was constructive, but thank you for stopping by none the less.

    I believe that the system I was inquiring about, if built correctly, could easily show both the previous and the next posts in order giving a range of the before and after posts.
    Perhaps existing in conjunction with the current system to intice those who stumble onto my older stuff to see what I am up to now.

    I will explore your suggestion Azaozz, thanks.

    Ever have any luck with this? I’m trying to do the same thing, without much success.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘A previous post list that begins after the oldest post on the page.’ is closed to new replies.