Forums

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

  1. bernk
    Member
    Posted 4 months 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
    moderator
    Posted 4 months 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. wearitwell
    Member
    Posted 4 months 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
    Anja

Reply

You must log in to post.

About this Topic