[resolved] get_children for the current post (4 posts)

  1. Dunkkan
    Posted 7 years ago #

    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.

  2. Dunkkan
    Posted 7 years ago #

    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 ); ?>
  3. Dunkkan
    Posted 7 years ago #

    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.

  4. Dunkkan
    Posted 7 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic