Support » Themes and Templates » How do I get a list of all images attached to a single post?

  • 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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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.

    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
    Anja

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How do I get a list of all images attached to a single post?’ is closed to new replies.