WordPress.org

Ready to get started?Download WordPress

Forums

link to latest post (11 posts)

  1. siounis
    Member
    Posted 7 years ago #

    there has GOT to be a bit of code to link to a latest post in a category or to all categories!

    like <php?> word press code </php>

    which would generate something like this:

    CLICK HERE FOR LATEST POST

    or maybe some code I can put into the herf tag.

    There is code for next post, previous post, first post but what of LATEST post?!

    I've been looking for weeks!

  2. moshu
    Member
    Posted 7 years ago #

  3. siounis
    Member
    Posted 7 years ago #

    moshu, i tried that exact wording at the start.

    all those search results tell you how to display the most recent post.

    but whats the code to link directly to the most recent post?

  4. moshu
    Member
    Posted 7 years ago #

    From where? I mean to link from where? Where do you want that link?
    Vague questions get vague answers...

  5. siounis
    Member
    Posted 7 years ago #

    ok, from anywhere really. but i guess if I had to chose from the header.

    Simply, I want to be able to have the word "LATEST POST" link to the latest post. And not link to the category page which lists all the post, but to actual post.

    A practical use of this is a webcomic. Having links

    FIRST, PREV, NEXT, NEW

    I know the code for the first three but what php code generates, or what code do i add to the herf to have NEW link to the latest post in a category.

    I also found a hack by using a pulgin that list the recent posts in a category to list the name of the post, but like I said having it a link.

    Look at this webpage.
    http://www.penny-arcade.com/comic

    they dont use wordpress.

    but I looked everywhere and found some other threads asking for the same thing:

    http://wordpress.org/support/topic/87469?replies=3

    http://wordpress.org/support/topic/116731?replies=1

    i hope this is clear enough for you moshu. you're my only hope!

  6. siounis
    Member
    Posted 7 years ago #

    :(

  7. moshu
    Member
    Posted 7 years ago #

    I don't think there is a "pre-made" code (aka template tag) for something like that. Sorry.

  8. drmike
    Member
    Posted 7 years ago #

    Hmm, sounds familiar.

    http://trac.wordpress.org/ticket/3876

    Oh well...

  9. siounis
    Member
    Posted 7 years ago #

    im confused, on http://trac.wordpress.org/ticket/3876 people offer some solutions, but i dont know enough about wordpress to understand them.

    are those solutions offered on the link that drmike posted actual solutions? cause if they are- hot diggidy!

  10. evaneckard
    Member
    Posted 6 years ago #

    I'm sorry this is so late, but you could do something like this:

    <?php query_posts('showposts=1'); ?>
    	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
        <a href="<?php the_permalink() ?>">Click here for latest post</a>
    	<?php endwhile; endif; ?>
  11. veevee
    Member
    Posted 6 years ago #

    Hmmm, that's really really close evaneckard, but for some reason, when I pasted this code in, my prev post, next post calls stopped generating links, and now ALL of my permalinks link to the latest posts. A fix anyone. I would also love it if anyone knew how to make this link to the most recent post in a specific category.

Topic Closed

This topic has been closed to new replies.

About this Topic