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.

When I'm posting a link for a WordPress page or post on a Facebook Page wall (using the "Post a link" option), I want Facebook to offer up, as choices, (a) all images which are embedded in the linked page/post as well as (b) a set of default images (in case the page/post in question has no embedded images).

What I've done is add (to wp_head) several candidate images in separate link rel="img_src" tags.

The problem is that these link rel tags appear to override any images that are actually embedded in the page/post.

Any advice would be appreciated.

share|improve this question
add comment

2 Answers

When you're adding the images in the head, do a query on the posts ID to find posts that are of the post type attachment with the parent ID equal to that of the current post. Then use these attachments to generate the image URLs in your header via wp_get_attachment_image_src .

This way the 'candidate' images will always be images attached to the current post

share|improve this answer
add comment

You need to use a Plugin that manipulates the data sent via the Facebook Open Graph Protocol, e.g. Facebook Opengraph. There are several others, also.

Related Posts

share|improve this answer
    
Thank you, Chip. I'll check it out. –  Jeff Cohan Jul 10 '11 at 18:56
add comment

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.