How would I grab a photo, that has been added to a post, and use it elsewhere on a site when there have been several photos added to the post? For example, my site has a blog (Wordpress) and a non-blog section. I want to pull one image from my latest post for use in this non-blog section. Keep in mind that there might be multiple photos associated with the post.

The trick to me seems to be how to designate one specific photo of however many are associated with a post as "the photo" that will be used in the non-blog portion of the site. Ideas? Suggestions?

  • 2
    You could populate a post meta options field with the name of that photo and then call it elsewhere via the ID of the post get_post_meta($post->ID, ....
    – kaiser
    Commented Mar 24, 2011 at 6:55

1 Answer 1


Well one photo can be assigned as the thumbnail as you can see in the post editor screen. Otherwise as the comment above suggested create a post meta field for example 'my_post_image' and place the id of the image attachment in that field. That is how WordPress saves the post thumbnail (look in the database, something like _post_thumbnail is the meta field name).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.