chuckreynolds / WPFBOGP

WordPress Open Graph plugin development
wordpress.org/plugins/wp-facebook-open-graph-protocol/
13 stars 19 forks source link

Grab all images in post from get_posts() using post_type attachment and $post->id as post_parent. #10

Open andrewryno opened 11 years ago

andrewryno commented 11 years ago

This should allow us to grab all images in the post, whether they are in a gallery or included directly in the post content.

chuckreynolds commented 9 years ago

for me later to reference (combining the three issues):

and

if ( ! function_exists( 'get_attached_media' ) ) {
    $attachments = get_attached_media( 'image', $post->ID );
}
chuckreynolds commented 9 years ago

after playing with this a bit - this only gets images that are attached to the post meaning if it was originally uploaded to that post/page. If an image is added to the content from the media library this won't pull it. If there was an image uploaded to a post and the image was removed as featured post or removed from content this will still pull that image. Ergo... it doesn't work for what we need it to.