WordPress.org

Ready to get started?Download WordPress

Forums

Next/Previous Post links w/o Generating title (3 posts)

  1. foglub
    Member
    Posted 5 years ago #

    Hi everyone.

    Is there a way to make an entire div tag a link to the previous post?

    I'm working on an extremely stripped down photo blog that displays one photo per post, and I'm trying to figure out a way that clicking on the photo will take you to the previous post. I figured that I could make the a link out of the div that is holding the post, or out of the content itself, but when I use the previous_posts tag it generate the title.

    Any thoughts? Is this possible?

    Thanks in advance.

  2. esmi
    Forum Moderator
    Posted 5 years ago #

    What happens if you use:

    <?php $img = '<img src="foo.jpg" width="300" height="300" alt="Foobar: Previous image" />';?>
    <div class="img_link"><?php previous_posts_link($img); ?></div>
  3. foglub
    Member
    Posted 5 years ago #

    Thanks for the reply. I'm not sure I understand where I'd place that code (I'm new to all of this), but I assume that would have to be placed within the post since there is image-specific code, not the single.php template.

    My goal is to find a way to universally apply a previous post link to all content within the div tag holding "the content" so when I create a new post the image will automatically advance backwards once you're inside the loop of single pages.

    Not sure if that makes this more confusing or if it clears things up.

Topic Closed

This topic has been closed to new replies.

About this Topic