WordPress.org

Support

Support » How-To and Troubleshooting » Next/Previous Post links w/o Generating title

Next/Previous Post links w/o Generating title

  • 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.

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

    @esmi

    Forum Moderator

    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>

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Next/Previous Post links w/o Generating title’ is closed to new replies.
Skip to toolbar