Posted By

bitsculptor on 06/19/12


Tagged


Versions (?)

Wordpress get attachements for post or page


 / Published in: PHP
 

URL: http://stackoverflow.com/questions/1815158/show-attached-image-to-post-on-wordpress

Gets a post or page's attached images and outputs them.

  1. $args = array(
  2. 'post_type' => 'attachment',
  3. 'post_mime_type' => 'image',
  4. 'post_parent' => $post->ID
  5. );
  6. $images = get_posts( $args );
  7. foreach($images as $image):
  8. echo wp_get_attachment_image($image->ID, 'medium');
  9. endforeach;

Report this snippet  

You need to login to post a comment.