";
} else {
$gallery_div = "".$gallery_name."
";
}
$output = $gallery_style . $gallery_script . $gallery_div;
} else {
if ($fg_type == 'photoswipe') {
$gallery_div = "".$gallery_name."
";
} else {
$gallery_div = "".$gallery_name."
";
}
$output = $gallery_style . $gallery_script . $gallery_div;
}
$images = explode( ',', $images );
// PAGINATION ### Change array for pagination ###
if($fg_pagination_active == 'on') {
$pagination = get_query_var('fg_page');
if(!isset($pagination) || empty($pagination)) { $pagination = 1; }
$images_array = array_chunk($images,$fg_pagination_number);
$pag = $pagination - 1;
$images = $images_array[$pag];
$num_page_for_pagination = count($images_array); // VALUE FOR PAGINATION FUNCTION
}
// #PAGINATION
$i = - 1;
// IF FOTORAMA CHANGE FOREACH
if($fg_type == 'fotorama') {
foreach ( $images as $id ) {
$image_url = wp_get_attachment_image_src( $id, $fg_thumbs_lightbox );
$attachment_caption_array = get_post( $id );
$attachment_caption = $attachment_caption_array->post_excerpt;
if(empty($attachment_caption)) { $attachment_caption = ' '; }
$output .= '
'.$attachment_caption.'
';
}
$output .= '
';
} elseif ($fg_type == 'photoswipe') { // IF PHOTOSWIPE
foreach ( $images as $id ) {
$image_url = wp_get_attachment_image_src( $id, $fg_thumbs_lightbox );
if($size == 'fg-normal') {
$link_text = wp_get_attachment_image( $id , $fg_thumbs_grid);
} else {
$link_text = wp_get_attachment_image( $id , $fg_thumbs_masonry);
}
if($fg_lazyload == 'on') {
if($size == 'fg-normal') {
$link_text = wp_get_attachment_image_src( $id , $fg_thumbs_grid);
} else {
$link_text = wp_get_attachment_image_src( $id , $fg_thumbs_masonry);
}
$link_text = '
';
}
$attachment_caption_array = get_post( $id );
$attachment_caption = $attachment_caption_array->post_excerpt;
if(empty($attachment_caption)) { $attachment_caption = ' '; }
// CHECK CAPTION
$caption_check = '';
if($fg_caption == 'off' || empty($attachment_caption) || $attachment_caption == ' ') {
$caption_check = 'no-caption';
}
// END CHECK CAPTION
$output .= '
';
}
$output .= '
';
$output .= '
';
} else { // IF #PHOTOSWIPE
foreach ( $images as $id ) {
$_post = get_post( $id );
$image_attributes = wp_get_attachment_image_src( $_post->ID, $fg_thumbs_lightbox );
if($fg_type == 'custom_url') {
$url = get_post_meta( $id, '_custom_url', true );
} else {
$url = $image_attributes[0];
}
$attachment_caption_array = get_post( $_post->ID );
$attachment_caption = $attachment_caption_array->post_excerpt;
if($size == 'fg-normal') {
$link_text = wp_get_attachment_image( $id , $fg_thumbs_grid);
} else {
$link_text = wp_get_attachment_image( $id , $fg_thumbs_masonry);
}
if($fg_lazyload == 'on') {
if($size == 'fg-normal') {
$link_text = wp_get_attachment_image_src( $id , $fg_thumbs_grid);
} else {
$link_text = wp_get_attachment_image_src( $id , $fg_thumbs_masonry);
}
$link_text = '
';
}
if($fg_type == 'lightgallery') {
$image_output = "
";
} elseif($fg_type == 'custom_url') {
$image_output = "
";
} else {
$image_output = "
$link_text
";
}
$orientation = '';
if ( isset( $image_meta['height'], $image_meta['width'] ) )
$orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
// LIGHTGALLERY
if($fg_type != 'lightgallery') {
$output .= "<{$itemtag} class='fg-gallery-item ".$animation_info."";
} else {
$output .= "<{$itemtag} data-src='$url' class='fg-gallery-item ".$animation_info."";
}
// #LIGHTGALLERY
// CHECK CAPTION
$caption_check = '';
if($fg_caption == 'off' || empty($attachment_caption)) {
$caption_check = 'no-caption';
}
// END CHECK CAPTION
$output .= "
<{$icontag} class='fastgallery-gallery-icon $caption_check'>$image_output";
if ($fg_caption == 'on' && !empty($attachment_caption)) {
$output .= "
<{$captiontag} class='fg-wp-caption-text fg-gallery-caption'>
" . $attachment_caption . "
";
}
$output .= "";
}
$output .= "
\n";
if($fg_thumbs_one == 'off') {
$output .= '
';
}
}
if($fg_pagination_active == 'on') {
$output .= '';
}
return $output;
}
}
new fg_functions();
// PAGINATION FUNCTION //
function get_fg_pagination($num_page_for_pagination,$pagination) {
$output = '';
return $output;
}
// ADD VAR FUNCTION FOR PAGINATION
function add_query_vars_fg_pagination( $vars ){
$vars[] = "fg_page";
return $vars;
}
add_filter( 'query_vars', 'add_query_vars_fg_pagination' );
// THUMBNAILS FUNCTION
function fastgallery_vc_add_image_sizes() {
add_image_size( 'fg-masonry', 500 );
add_image_size( 'fg-normal', 800 , 800 , true);
}
add_action( 'init', 'fastgallery_vc_add_image_sizes' );
// HEX FUNCTION
function fastgallery_vc_hex2rgb($hex) {
$hex = str_replace("#", "", $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
$b = hexdec(substr($hex,4,2));
}
$rgb = array($r, $g, $b);
return $rgb;
}
function photoswipe_style($rgba_main_color,
$fg_main_color,
$fg_secondary_color,
$rgba_secondary_color,
$fg_pagination_active,
$fg_spacing_active,
$fg_spacing,
$fg_image_lightbox,
$selector,
$fg_gallery_name_font_size,
$fg_gallery_name_font_color,
$fg_gallery_name_text_align,
$float,
$itemwidth,
$fg_gallery_name_show
) {
$gallery_style = "
";
return $gallery_style;
}
?>