• ashadeofgrey

    (@ashadeofgrey)


    Hello,
    I run a photoblog over at https://www.ashadeofgrey.net
    Basically, I upload one photo at a time, and it’s displayed on the current page, then users can scroll back one image at a time to view the rest.
    I’ve spent a little time searching for a plugin/hack that allows a user to view the previous post by clicking on the image in my post, but have not found anything.
    Does anyone know an easy way to do this?
    Thanks in advance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter ashadeofgrey

    (@ashadeofgrey)

    I’m still trying to solve this issue, any ideas yet?

    With WP’s template tag, get the link to previous post, then with css, display the link as a block with defined width and height, and position it so that it covers/overlays the image. How? I’m not telling. ??

    alphaoide, I understand what you’re saying, but I’m still not getting it. I feel like it’s at the tip of my tongue. I tried z-index to overlay the image, but I think it has something to do with the correct syntax of the php code.

    I too want the functionality that ashadeofgrey is asking for. The trouble that I’m seeing is that <?php previous_post(); ?> is used for a text link to the previous post and not for an image, such as that on a photoblog. I want the visitor to my photoblog to be able to click on the image to see the previous post – not the text “previous”.

    Is the problem the tag or the syntax? I’ve tried the following without success:

    <?php previous_post('%','<?php the_content() ?>','no','no'); ?>

    Thanks in advance!

    try this. https://www.blueblurry.com/navigation-fix/

    His #3.. is what you’re looking for

    Thanks charbyte, that’s the best example I’ve seen so far. Unfortunately, I still use WordPress1.2 and the php didn’t work. I may have to upgrade to 1.5

    I could still use any ideas, if anyone reads this. Thanks!

    You could always rip out the permalink-related code in previous_post() and reuse it. The following replaces the_content() in your template:

    <?php global $post, $tableposts;
    $previous = @$wpdb->get_var("SELECT ID FROM $tableposts WHERE post_date < '$post->post_date' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 0, 1");
    if ($previous) {
    $link = get_permalink($previous);
    echo '<a href="' . $link . '">' . $post->post_content . '</a>
    ';
    } else {
    the_content();
    } ?>

    Thanks Kafkaesqui, that did it! Once I read the php code you gave I saw the light. Now I have to tweak the CSS to present it how I had it originally.

    Thanks again!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘previous post on image click’ is closed to new replies.