Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $image_count = 0;
- $max_images = 10; //set this to the max number of images you want.
- $ids = get_posts( array( 'post_type' => 'post', 'posts_per_page' => -1 ,'fields' =>'ids') );
- if (count($ids) > 0){
- foreach ($ids as $ids){
- while ($image_count < $max_images){
- $args = array(
- 'post_type' => 'attachment',
- 'numberposts' => -1,
- 'post_status' => null,
- 'post_parent' => $id,
- 'exclude' => get_post_thumbnail_id($id)
- );
- $attachments = get_posts( $args );
- if ( $attachments ) {
- foreach ( $attachments as $attachment ) {
- while ($image_count < $max_images){
- echo '<dl class="gallery-item">
- <dt class="gallery-icon">
- <a rel="shadowbox[sbalbum-1];player=img;" href="' . get_permalink($attachment->ID) . '">'. wp_get_attachment_image( $attachment->ID, 'footer_thumbs' ) . '</a>
- </dt>
- </dl>';
- $image_count = $image_count + 1;
- }
- }
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement