Return to Snippet

Revision: 64164
at July 11, 2013 02:00 by JoshChris


Initial Code
<?php
    $attachments = get_children( array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' =>'image') );
    foreach ( $attachments as $attachment_id => $attachment ) {
            echo wp_get_attachment_image( $attachment_id, 'medium' );
    }
?>

Initial URL


Initial Description
Short php snippit to get all images that are attached to a post or page in wordpress. 
Need to mod to only get gallery images.

Initial Title
Get all attached images for a wordpress post/page

Initial Tags


Initial Language
PHP