";
$i = 0;
//image_attr
$image_attr = array();
$image_attr[ 'sizes' ] = $this -> czr_fn_generate_gallery_img_sizes( $columns );
foreach ( $attachments as $id => $attachment ) {
if ( trim( $attachment->post_excerpt ) )
$image_attr[ 'aria-describedby' ] = "$selector-$id";
$image_output = wp_get_attachment_image( $id, $atts['size'], false, $image_attr );
if ( ! empty( $atts['link'] ) && 'file' === $atts['link'] ) {
$link = wp_get_attachment_url( $id );
$image_output = sprintf( '
%2$s', $link, $image_output );
$image_output = apply_filters( 'czr_gallery_image_linking_media', $image_output, $id, $attachment );
} elseif ( ! empty( $atts['link'] ) && 'none' === $atts['link'] ) {
//no link
//maybe add expand img button
$image_output = apply_filters( 'czr_gallery_image_linking_no_media', $image_output, $id, $attachment );
} else {
//link to attachment page
$link = get_attachment_link( $id );
$image_output = sprintf( '
%2$s', $link, $image_output );
//maybe add expand img button
$image_output = apply_filters( 'czr_gallery_image_linking_no_media', $image_output, $id, $attachment );
}
$image_meta = wp_get_attachment_metadata( $id );
$orientation = '';
if ( isset( $image_meta['height'], $image_meta['width'] ) ) {
$orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
}
$output .= "<{$itemtag} class='gallery-item {$itemclass}'>";
$output .= "
<{$icontag} class='gallery-icon {$orientation} {$iconclass}'>
$image_output
{$icontag}>";
if ( $captiontag && trim($attachment->post_excerpt) ) {
$output .= "
<{$captiontag} class='wp-caption-text gallery-caption' id='$selector-$id'>
" . wptexturize($attachment->post_excerpt) . "
{$captiontag}>";
}
$output .= "{$itemtag}>";
}
$output .= "
\n";
return $output;
}
function czr_fn_maybe_lighbox_attachment_link( $link_markup, $id, $attachment ) {
if ( ! apply_filters( 'tc_gallery_fancybox', esc_attr( czr_fn_opt( 'tc_gallery_fancybox' ) ) , $id ) ) {
return $link_markup;
}
$title = trim($attachment->post_excerpt) ? ' title="'. wptexturize($attachment->post_excerpt) .'"' : '';
return str_replace( '