Only calling 5 gallery images from page?
-
Hi,
I am working on a wordpress site (v2.9.2) and have a gallery for each pf a specific page type. However the array populating the gallery (code from the page is below) is only returning 4 values maximum.Here is a sample page where you can see what I am discussing:
https://111.223.226.6/~blomwark/projects/heritageFor example, the page linked above should have 9 images.
If I use the array to return text I can see it is displaying 4 values, so I can rule out a problem with the Lightbox etc.
Any help would be extremely apprecited.
Many thanks
<?php $args = array( 'post_type' => 'attachment', 'post_mime_type' => 'image/jpeg', 'post_status' => null, 'post_parent' => $page->ID, 'orderby' => 'menu_order', 'order' => 'asc' ); $attachments = get_posts($args); if ($attachments): $gallery = array(); foreach ($attachments as $attachment): if ($attachment->menu_order==0): $cover['title'] = $attachment->post_title; $cover['image'] = wp_get_attachment_url($attachment->ID); else: $gallery[$attachment->menu_order]['title'] = $attachment->post_title; $gallery[$attachment->menu_order]['image'] = wp_get_attachment_url($attachment->ID); endif; endforeach; sort($gallery); $gallery_image = '<img src="'.$cover[image].'" alt="'.$cover[title].'" />'; if (count($gallery)>0): ?> <a href="<?php echo $gallery[1]['image']; ?>" rel="lightbox[]"><?php echo $gallery_image; ?></a> <p><a href="<?php echo $gallery[1]['image']; ?>" rel="lightbox[]">Click here for more images</a></p> <?php foreach ($gallery as $item): ?> <a href="<?php echo $item['image']; ?>" class="hidden" rel="lightbox[]"> </a> <?php else: echo $gallery_image; endif; endif; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Only calling 5 gallery images from page?’ is closed to new replies.