Support » Plugins » get_children for the current post

  • Resolved Dunkkan


    Hello guys,

    I’d like to display in a specific div, in single.php, all the attachments for the current post : vids, images, gallery.

    Is this possible ?

    I’ve tried to work with get_children, but I don’t know how to ask for the current post attachments (the example in the Codex gives you ALL of your attachments).

    Thanks for any help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • This would be for the images part, and I know I could change the post_mime_type to include any other file, but this isn’t even printing a simple image. 🙁

            $images =& get_children( 'post_parent='.
            $post->ID.'&post_type=attachment&post_mime_type=image' );
    <?php echo wp_get_attachment_image( $image->ID ); ?>

    Ok I think that retrieving attachments works only with uploaded images/media 🙂

    I was linking images and pretending they were attachments. I’ll try it now and I’ll post back.

    All is ok now. The question would be : why WP doesn’t works the linked images in a post as attachments ?

    Anyway I mark this thred as resolved.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get_children for the current post’ is closed to new replies.