Need some help with quirky Attachments problem
-
I am trying to display the the images in the post on the index.php. This is what I have so far…
$attachments =& get_children( array( 'post_parent' => $theID, 'post_type' => 'attachment', 'post_mime_type' =>'image' ));
if ($attachments === FALSE) { echo 'no attachments'; } else { foreach($attachments as $attach) { $attachmenturl=wp_get_attachment_url($attach->ID); echo $attachmenturl; //$attachmentimage=wp_get_attachment_image( $attach->ID, 'thumbnail' ); } }
The problem is, it only spits out the image of the first post, and echoes ‘no attachment’ for the rest.
no attachments
no attachments
no attachments
https://localhost:8888/<my site>/wp-content/uploads/2008/10/a.jpgMy code is all within the Loop.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Need some help with quirky Attachments problem’ is closed to new replies.