Dunkkan
Member
Posted 2 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.
Dunkkan
Member
Posted 2 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. :(
<?php
$images =& get_children( 'post_parent='.
$post->ID.'&post_type=attachment&post_mime_type=image' );
?>
<?php echo wp_get_attachment_image( $image->ID ); ?>
Dunkkan
Member
Posted 2 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.
Dunkkan
Member
Posted 2 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.