Ready to get started?Download WordPress


link to latest post (11 posts)

  1. siounis
    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:


    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
    Posted 7 years ago #

  3. siounis
    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
    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
    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


    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.

    they dont use wordpress.

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



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

  6. siounis
    Posted 7 years ago #


  7. moshu
    Posted 7 years ago #

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

  8. drmike
    Posted 7 years ago #

    Hmm, sounds familiar.


    Oh well...

  9. siounis
    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
    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
    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