For Gallery

    have_posts()): setup_postdata( $post ); while($q->have_posts()): $q->the_post(); ?>
  • ID) ) {the_post_thumbnail( $size );}else{get_gallery_image($post->ID,'medium');}?>