hey HI , I'm trying to add a Gallery retrieving all the attach images, no matter if they are in the content , but I really don't know what am I doing wrong or if I'm using the incorrect technic .
For the record... I use:
WP 2.9.2
I use the examples that are in this great site:
http://wpengineer.com/easier-better-solutions-to-get-pictures-on-your-posts/
and I use this:
<?php
$attachments = get_children( array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image') );
foreach ( $attachments as $attachment_id => $attachment ) {
echo wp_get_attachment_image($attachment_id);
} ?>
But no image are displayed
The Only thing I need is too add the <img src="url" /> of the attached images....
also I was wondering if this could be use as function, I mean:
function the_gallery() {
$attachments = get_children( array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image') );
foreach ( $attachments as $attachment_id => $attachment ) {
echo wp_get_attachment_image($attachment_id);
}
}
and Call it with:
the_gallery();
Hope somebody could give me a hand on this...
Thanks in advance