• Dear all,

    I want to call the first image attachement from a post and display a smaller image of it on my index/category pages.
    I’m using two loops on my index page. The first loop calls the latest post and the second calls the rest.

    I’m using the post_image() plugin to call my post-image attachments, but only a blank space is appearing in the first loop and both the attachment and the plugin are bizarelly appearing in the second loop.

    The link for index.php is https://www.r4e.org/Diary and the loop’s code from Index.php code is below:

    https://pastebin.ca/109987

    I’d like to ask if someone could kindly point out where I’m going wrong in both loops and why the attachments are showing on the index page when no call has been for them (nor have they been ‘sent to the editor’). Is this normal?

    Thankyou very much,
    Steven

Viewing 2 replies - 1 through 2 (of 2 total)
  • I am not familiar with the plugin… but in the first Loop everything is set to “false, false” – have no idea what that means, but…

    In the second loop you call the post_image plugin twice.

    Thread Starter rideforver

    (@rideforver)

    Hi Moshu,

    First off, thanks to your fresh eyes and my obviously jaded ones, you solved the mystery of the reaccuring image in the second loop. Thankyou very much. The second loop works with the plugin just fine and the real problem lies with the first one.

    The mystery with the first loop is that if I send an attachment ‘to the editor’ the attachement shows on both the post and the index.php!! Go figure! This does not happen in the second loop and I’ve tested multiple scenarios to come up with an alternative conclusion (which I can’t find).

    The only way the plugin will partially work in the first loop, is if I ’embed’ the post_image() in an img tag with set dimensions (which is what I want). But in that scenario a blank space just appears for the image… and of course no image!! What do you think the issue could be? I could just send the attachement to the editor, but this seems a bizarre solution. I would rather find another solution or another alternative to displaying the most recent post (in which the plugin will work).

    The ‘false, false’ plugin parameters in the first loop declare the plugin free of an img tag wrap in the first instance and display it in its raw state in the second. I’ve tried all the combinations of plugin parameters I can think of in the first loop but no results.

    Thanks again for your help.
    Regards Steven.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Post image-attachements not appearing properly on Index.php’ is closed to new replies.