Advertisement
Digitalraindrops

ImageBand functions.php

Apr 16th, 2012
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. add_image_size( 'list-thumbnail', 200, 120, true );
  2.  
  3. function dr_Get_Post_Images() {
  4.     global $post;
  5.    
  6.     $img_args = array(
  7.         'post_type' => 'attachment',
  8.         'numberposts' => -1,
  9.         'post_status' => null,
  10.         'post_parent' => $post->ID
  11.     );
  12.  
  13.     $attachments = get_posts( $img_args );
  14.     if ( $attachments ) {
  15.         $counter=0;
  16.         echo '<div class="row">';
  17.         foreach ( $attachments as $attachment ) {
  18.             $counter++;
  19.             $class = ( $counter % 3 ) ? '<div class="third">' : '<div class="third last">';
  20.             echo $class;
  21.             echo wp_get_attachment_image( $attachment->ID, 'list-thumbnail' );
  22.             echo '</img></div>';
  23.         }
  24.         echo '</div>';
  25.         echo '<div style="clear:both;"></div>';
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement