WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] link to single page post of first post?

[Resolved] link to single page post of first post?

  • I want a link to the first post to be permanently on the sidebar but I don’t know how to code it and can’t find anything in the codex. I tried linking to post#1 but that just put it in the loop so it wasn’t within single.php.. I want to link directly to the single post view. How could I do that?

Viewing 5 replies - 1 through 5 (of 5 total)
  • <?php echo get_permalink(X); ?>

    Would be the safest approach…

    Replace X with the ID number of said post..

    Example:
    <?php echo get_permalink(10); ?>

    cool thx! now i just need to get it to work with the image I want it linking..

    <a href="<?php echo get_permalink(1); ?>">
    <img  class ="nav" src="<?php bloginfo('template_directory'); ?>
    /images/start.gif" alt="go to the first entry"/></a>

    just links to the homepage, so I think I gotta do something a little different.

    So you’re sure 1 is the correct ID for the first post you have?..

    Just because it’s the first post doesn’t mean the ID is 1…

    you’re good! lol yeah.. i shoulda realized.. it’s 43, not 1.

    thanks a lot for the fix.

    i dunno if it’s just me but the codex seems a bit hard to locate things in.

    Yes it is a bit here and there right now…

    The best thing you can do is ask here, if anyone knows where to find it in the codex they’ll post a link for you…

    If it’s not in the codex we can still provide whatever info you need about a tag or function right here….

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] link to single page post of first post?’ is closed to new replies.
Skip to toolbar