• Hello,
    I’d like to have a small image associated with each post, but placed outside the post content. I also don’t need a photo gallery plugin or thumbnail, just a tag for an associated image that I can put in a template. Can anybody advise a plugin that does that, if any?
    Thank you,
    Ult

Viewing 3 replies - 1 through 3 (of 3 total)
  • Will each post have it’s own unique image? If so, something like this should do:

    <img src="post-<?php the_ID(); ?>.jpg" title="post image" />

    Then just name the images “post-#.jpg”, where # is the ID number for each post. You’ll obviously want to change the src to point at where you store the images, like say:

    /images/posts/post-<?php the_ID(); ?>.jpg

    Are you talking about having the same image for every post or a different image on every post? Or the same image for every post in a specific category?

    If you want the same image on every post, you simply put a link to the image within the index.php part of the Loop that features the entire post, or on the single.php or post.php, whichever “single page” template file your theme uses. Put it wherever you want it to appear, like next to the title or wherever.

    There are plugins that will help you put a specific image associated with a category on your posts, and to do the other things, but to just put the same graphic image on every post, simply put a link to it like this:

    <img src="graphics/ball.gif" />

    wherever you want it to show up.

    Thread Starter ult

    (@ult)

    Kafkaesqui, yes, each post may have it’s own unique image (ideally, if there is no image specified, a default image can be used); anyway, thank you for an idea. Storing the image’s name in the db would be more preferable, but I didn’t yet find any plugin that does it. But I now figured out that the real problem is that the image is outside the loop. Though, I don’t understand why I should use loop in a page displaying a single blog element.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘help find the simplest way to associate an image with a post’ is closed to new replies.