• Hi,

    I’m new to WordPress and have read through the documentation in the ‘Docs’ section; have also searched the forums for this but cannot find anything quite like what I want to do.

    My site has a list of recent posts showing only the title of the post. I want these to be hyperlinked, so that when the user selects the link they are taken to another page to view the whole post. I’m not using a template, because – I’ll be honest – I don’t really have time to expend on getting the best out of a template.

    How can I create a standard HTML anchor tag to include the ID of a post? Also, on the destination page, what do I have to do to pass the ID to the WP store of posts to retrieve the content of the post?

    Thanks in advance.
    TB

Viewing 2 replies - 1 through 2 (of 2 total)
  • My site has a list of recent posts showing only the title of the post. I want these to be hyperlinked, so that when the user selects the link they are taken to another page to view the whole post.

    a hyperlinked title – linking to the single post – would look like this, for instance:

    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

    (assuming this is in a wordpress loop)

    Also, on the destination page, what do I have to do to pass the ID to the WP store of posts to retrieve the content of the post?

    the permalink links to single.php, so there is no need to do anything.

    unless you want to do something more complicated, in which case you need to provide more details.

    Thread Starter tnybutler@gmail.com

    (@tnybutlergmailcom)

    Thanks very much for replying Alchymyth. This is very helpful.

    Best regards,
    TB

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Create an HTML anchor tag containing post ID’ is closed to new replies.