Array of images for a gallery
-
Hi, Im trying to get an array of images all the wordpress posts and all I am getting is the newest image from the last post, not all of them.
global $post; $photos = get_children(array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC') ); $results = array(); if ($photos) { foreach ($photos as $photo) { $keys [] = $photo->ID; $captions [] = $photo->post_excerpt; $descriptions [] = $photo->post_content; // get the correct URL for the selected size $results[] = array(image => wp_get_attachment_url($photo->ID, 'full'), title => '', url => ''); } } return str_replace('\/', '/', json_encode($results)); }
could anyone tell me what is wrong?
thanks
- The topic ‘Array of images for a gallery’ is closed to new replies.