Skip to content

Instantly share code, notes, and snippets.

@codescribblr
Created February 13, 2014 21:42
Show Gist options
  • Select an option

  • Save codescribblr/8984473 to your computer and use it in GitHub Desktop.

Select an option

Save codescribblr/8984473 to your computer and use it in GitHub Desktop.
Wordpress get attachements for post or page
$args = array(
'post_type' => 'attachment',
'post_mime_type' => 'image',
'post_parent' => $post->ID
);
$images = get_posts( $args );
foreach($images as $image):
echo wp_get_attachment_image($image->ID, 'medium');
endforeach;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment