', 9 ); // Available filter: gallery_style
foreach ( $attachments as $id => $attachment ) {
$img_lnk = get_attachment_link($id);
$img_src = wp_get_attachment_image_src( $id, $size );
$img_src = $img_src[0];
$img_alt = $attachment->post_excerpt;
if ( $img_alt == null )
$img_alt = $attachment->post_title;
$img_rel = apply_filters( 'gallery_img_rel', 'attachment' ); // Available filter: gallery_img_rel
$img_class = apply_filters( 'gallery_img_class', 'gallery-image' ); // Available filter: gallery_img_class
$output .= "\n\t" . '<' . $itemtag . ' class="gallery-item gallery-columns-' . $columns .'">';
$output .= "\n\t\t" . '<' . $icontag . ' class="gallery-icon">

' . $icontag . '>';
if ( $captiontag && trim($attachment->post_excerpt) ) {
$output .= "\n\t\t" . '<' . $captiontag . ' class="gallery-caption">' . $attachment->post_excerpt . '' . $captiontag . '>';
}
$output .= "\n\t" . '' . $itemtag . '>';
if ( $columns > 0 && ++$i % $columns == 0 )
$output .= "\n
\n" . '