• Is there a way of linking to the single page of the 2nd most recent most?

    On my main page, I’ve limited it to display only 1 post using <?php query_posts('showposts=1'); ?>
    (The reason being, so I can keep the number of posts at a higher number for the archive pages)
    So in effect, the home page is just like any other single page, just the most recent post.

    Of course being the main page, the <?php previous_post_link('%link', 'Previous') ?> tag doesn’t work. I want it to behave just like all the other single pages (from the viewers perspective).

    I figure the easiest way would just be writing a tag to get the permalink to the second most recent post, but I can’t work out how (since the permalink tags won’t have anything to do with offset).

    Does anyone know how I might go about it?

Viewing 1 replies (of 1 total)
  • Thread Starter Nathan Adams

    (@nathan-adams)

    OK, I’ve managed to do it by using the “Recent Posts” plugin.
    https://www.ads-software.com/extend/plugins/recent-posts/

    I used the code <?php mdv_recent_posts(1, '', '', true, 1, false, false); ?>
    This limits the list of recent posts to 1 entry, and offsets it by 1 (ie. it lists only the second most recent post)

    I then modified the plug in so that instead of calling $post_title, it just writes ‘Previous’ instead.

    Obviously not an ideal solution, and I’m still open to better (non hacky) ways of doing this. But I figure at the very least, someone else might benefit from at least a partial solution.

Viewing 1 replies (of 1 total)
  • The topic ‘Linking to 2nd most recent post’ is closed to new replies.