• Hey,
    I don’t know if this can be done, but i would like to post an article with a “more” tag in it, nut with an image before the “more” tag. However i want the image to be displayed only if the permalink is clicked, not if the teaser only is visible.
    Better yet would be to display only a thumbnail in the teaser, but the full image in the complete article (i can of course prepare the thumbnail manually, no need to use a photolog hack).
    Any idea how to do this?
    Thanks,
    Eduardo

Viewing 15 replies - 1 through 15 (of 18 total)
  • If it is before the more tag, then when someone clicks on it, the image won’t be visible, ’cause clicking on the more tag by default takes you to the position of the more-text in the page..(scrolls down that far automatically.
    Why don’t you put the image inside the more-text, so that only someone who clicks the more link can see it?

    Thread Starter anatman

    (@anatman)

    Hm, yeah. I forgot that the page will scroll down…
    The reason for the question is: i would like to have a light-weight (a few KBs) thumbnail to make the post look good and attract atention, and when the permalink was clicked the reader would see the full-sized picture (like 50-90KB).
    I would have a few posts (five) like this on the front page: if i don’t use thumbs, the page will be heavy and slow to load. If i use the thumbs, it won’t be too heavy and i still keep some of the colorful looks on the front page.
    Anyway, if it can’t be done i will put the image after the “more” tag…

    I think the above is what I’m looking for too:

    Bascially I’d like a convenient method of adding an image to a post, such that an auto-generated thumbnail appears with the post intro, but the full-size image appears on the post’s permalink page, along with the full-text of the post.

    Is there a favoured image plug-in that will handle this?

    Cheers,
    tamper

    I am looking for this too. I think is possible by modify the single.php to exclude the thumbnail and replace with fullsize image. If only I am the expert of the php scripts.

    Let says:
    * Large and small image show up at same spot in post & single page
    * Large file is something like myimage.jpg
    * Small file has same name, but with “-thm”: myimage-thm.jpg

    So when you click on the permalink bring you to the single.php and the single.php just strip off the “-thm” so the image will display on the single page.

    I am also looking for this plugin.

    Depending on how much text you want to display for your post’s intro, you could just embed your thumbnail in the post’s excerpt. call the_excerpt in the loop on index.php and the_content on single. A bit annoying to have to do for every post, but it’s one way to accomplish your goal short-term.

    Mumkin, I total agreed with you. It pain in the $ss to do that every post.

    The Excerpt Reloaded plugin may go some way to streamlining the process, though I’ve not tried it myself.

    I am trying to use “The Excerpt Reloaded Plugin” I can’t get the thumbnail to show on the frontpage and the full fullsize image to show on the full page. Do you have any ideas how can I accomplish this task. Thanks

    I am also looking exactly for this…I want to show just a thumbnail in the front page and full size image on the posts page. I think rocky2889s (6 posts above this) idea is the best way.
    Im willing to try this but I have no idea where in the code this can be done. Im thinking maybe in the comments page of your template but Im really not sure.
    If anyone tells me where to start looking , I
    ll find a way to hack something up.

    Let us just reexamine what the question really is. Something like *Can we put php in the middle of post text* ? The answer probably is yes we can. But not without very considerable rengineering I would think. Plugins are going to be needed. Hacking is going to be required. But yes. In principle why not ?

    Isnt there a way to tell if we are currently in the comments page?
    I was thinking of adding code to the start of the comments page for the template I
    m using.I saw this at the beggining but Im not sure if this is what Im looking for:

    if (‘comments.php’ == basename($_SERVER[‘SCRIPT_FILENAME’]))
    die (‘Please do not load this page directly. Thanks!’);

    Cant I add a piece of code similar to that that will tell it to load
    img.jpg instead of img_thm.jpg?

    Ive just started using WP a few days ago so Im still learning how it works.Im looking through the wiki but some parts are not complete.

    is_single() will get us started.The respective file paths need to be stored in a new variable I would think.

    alright I was just reading upon is_single() Root
    One thing Im still not getting:
    You are saying that you can
    t (or at least it would take too much work) insert php code in to a post? From what Ive read the part Im interested in would be The Loop. Maybe I could use a plugin I saw somewhere for inserting PHP code into a post?

    All right, I got this working. I set it up on my test blog and its working perfectly for now.Im using Photopress and Priyadis PHP Exec plugin.
    1)Get both plugins
    PHP Exec Plugin
    Photopress

    Install them both as you normally would.

    2)Now as per the PHP Exec plugins instruction insert php code in your post like this:


    <phpcode>
    <?php
    if (is_single()) {
    echo "<img src=https://example.com/wp-content/photos/photo.jpg><br>
    This is for post page";
    }
    else {

    echo "<img src=https://example.com/wp-content/photos/thumb_photo.jpg width=130 height=69><br>
    This is for frontpage ";
    }
    ?>
    </phpcode>

    You can see it in action Here
    It really wasnt that hard and my php knowledge is practically zero.Im sure someone can make it much prettier.
    Photopress makes the thumbnailed image automatically for you so you only have to upload your picture and tell it to post the thumbnail.Then just copy and paste the image insertion code into the code I posted above. You cant preview so try testing it somewhere first.
    I
    m going to try to merge this into Photopress so you don`t have to go cutting and pasting stuff everywhere and it places everything in its place.
    This code might also have to be edited to display thumbnails for frontpage and archive pages depending on whether your template shows posts while in the archive

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘conditionally displaying an image’ is closed to new replies.