Support » Plugins » Linking directly to the first/last post

  • I’m trying to find a way to link directly to the first and last post in a particular category, but I’m struggling to find a nice way of doing it. Ideally, the links would be generic, so they can be included in global navigation.

    At the moment, I’m jumping to the category, where I’m using query_posts to show one post per page. This gives me a “jump to latest” link – but I can’t get any Prev/Next page navigation working with it, and ideally it’d be nice to jump straight to the URL for the single post, rather than within the category structure.

    Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m also trying to find a way to link directly to the first post of a category but so far the best method I’ve found is to use get_permalink.

    http://codex.wordpress.org/Template_Tags/get_permalink

    Unfortunately this means you have to link directly to that first post within the template. If you want to see it in action, you can take a look at a comic theme that I’m working on here:

    http://www.idle-thoughts.com/demo

    I’m also using Kaf’s Post templates by category which you can access from his website http://szub.net/ which allows you to generate a single page theme for a specific category.

    This is how the comic navigation looks like:

    <p> <div class="comicnav">
    <table border="0" width="100%"><tr><td align="left">
    <div class="alignleft">
    <!– THIS LINKS TO THE VERY FIRST POST FROM THE CATEGORY –>
    < a href=” < ? php echo get_permalink(9); ? > “>&laquo First< / a>
    <!– THIS IS THE PREVIOUS LINK –>
    <?php previous_post_link($format=’&laquo %link’, $link=’%title’, $in_same_cat = true); ?> </p>
    <p> </div></td>
    <td align="right"><div class="alignright">
    <!– THIS IS THE NEXT LINK –>
    <?php next_post_link($format=’%link &raquo;’, $link=’%title’, $in_same_cat = true); ?>
    <!– THIS LINKS TO THE MAIN PAGE –>
    < a href = ” < ? php echo get_settings( ‘home’ ); ? > “>Latest »</ a>

    I’m also currently using wordpress 2.1.

    still looking for a way to link to the latest post in a categroy without showing the title of the post.

    eg:

    click “LATEST POST” or “FIRST” would like to the latest post in the cat. i know the code for the next and prev posts:

    <?php next_post_link($format=’%link »’, $link=’%title’, $in_same_cat = true); ?>

    but what of the first and latest (mostly just the latest)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Linking directly to the first/last post’ is closed to new replies.