• Hello,

    I’ve got my custom page setup, and when I try to link to the latest post only with
    “>

    It doesn’t work– it goes to the oldest post instead of the latest.

    Any ideas?

    MANY MANY THANKS

    gloria

Viewing 4 replies - 1 through 4 (of 4 total)
  • Trying to link with…what? Your post got mangled.

    Thread Starter gloriagoldrea

    (@gloriagoldrea)

    I tried to do it with
    “>

    but it goes to the oldest instead of the last.

    thanks

    Thread Starter gloriagoldrea

    (@gloriagoldrea)

    weird, it deleted it again!
    <a href="<?php the_permalink() ?>"></a>

    This depends a lot on what’s already happening on the page, if there’s a Loop or not and if you want to do it inside that loop or later. the_permalink just fetches the permalink for whatever post is being processed, and if you have a Loop that processes a number of posts, the_permalink points to that last post, not the first.

    You want to use get_permalink() to fetch the permalink of your first post and then display it. For that to work, you need to figure out the post_id of that first post, of course.
    You could also do a Loop that does a query_posts with “showposts=1” and then run the_permalink().

    Really depends on what the page is doing/trying to do, need more information. This codex entry has a lot of information on how to do single and multiple Loops on a page.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to make link to recent post?’ is closed to new replies.