Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
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 Mar 24 '11 at 6:55

1 Answer 1

up vote 2 down vote accepted

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).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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