How do I get a list of all images attached to a single post? (3 posts)

  1. bernk
    Posted 6 years ago #

    If I have a post and I go to add images I can add images to its Gallery without inserting them into the actual post.

    What I need to do is build a CSV list of the paths to all of the images to pass to Flash.

    Anyone have any ideas?

  2. MichaelH
    Posted 6 years ago #

    You will want to look at get_children(). A good example of usage is in wp-admin/includes/media.php at line 1058 (in 2.8)

    $attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC') );

    That code comes from the function get_media_items() that's worth reviewing.

  3. zartgesotten
    Posted 6 years ago #

    I used this code once with a slightly different purpose. But it should be no problem to change it so it will match your needs...

    Automatic imageset
    Good luck

Topic Closed

This topic has been closed to new replies.

About this Topic