';
foreach( $attachments as $attachment )
{
$counter ++;
$img = wp_get_attachment_image_src( $attachment->ID, $size );
$lightbox_img_src = Av_Responsive_Images()->responsive_image_src( $attachment->ID, $lightbox_img_size );
$alt = get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true );
$alt = ! empty( $alt ) ? esc_attr( $alt ) : '';
$title = trim( $attachment->post_title ) ? esc_attr( $attachment->post_title ) : '';
$description = trim( $attachment->post_content ) ? esc_attr( $attachment->post_content ) : '';
$caption = trim( $attachment->post_excerpt ) ? esc_attr( $attachment->post_excerpt ) : '';
$custom_link = get_post_meta( $attachment->ID, 'av-custom-link', true );
$custom_link = ! empty( $custom_link ) ? esc_attr( $custom_link ) : '';
$lightbox_title = $title;
switch( $lightbox_text )
{
case 'caption':
$lightbox_title = ( '' != $caption ) ? $caption : $title;
break;
case 'description':
$lightbox_title = ( '' != $description ) ? $description : $title;
break;
case 'no_text':
$lightbox_title = '';
}
if( $links != '' ) // ignore custom link, if lightbox is active
{
$custom_link = '';
}
else if( $custom_link != '' )
{
if( '' != $title )
{
$title = ' - ' . $title;
}
$title = __( 'Click to show details', 'avia_framework' ) . $title;
}
$output .= "
';
}
$output .= '