WordPress posts – attached images

Is there any way to display all attached images to a certain post? I am using the Nivo Slider jQuery plugin and looking for a smart way to add images to it. The best would be just to create a post and then attach the images I want in the slider. So what I need is some kind of loop that echoes all the attached images from a certain post.

Related posts

Leave a Reply

1 comment

  1. global $post;
    $attachements = query_posts(
        'post_type' => 'attachment',
        'post_parent' => $post->ID, // or static id, i.e. 7
        'posts_per_page' => -1
    );
    foreach($attachements as $attachment){
        $thumbimg = wp_get_attachment_link( $attachment->ID, 'thumbnail-size', true );
        echo $thumbimg;
    }
    

    More.