<?php 
/*
 * @link              http://awesomebootstrap.net
 * @since             1.0.0
 * @package           Gallery box wordpress plugin    
 * description        All gallery options set
 *
 * @  Gallery box
 */
 if ( ! function_exists( 'gbox_style_add' ) ) :
 function gbox_style_add(){
 //image gallery options
 if($Gimage = get_option('img_style')){
$Gimage = get_option('img_style');
}

$img_title_back = isset( $Gimage['img_title_back'] )  ? $Gimage['img_title_back'] : '#000000'; 
$img_border = isset( $Gimage['img_border'] ) ? $Gimage['img_border'] : 0; 
$img_border_color = isset( $Gimage['img_border_color'] ) ? $Gimage['img_border_color'] :'#ffffff'; 
$img_border_type = isset( $Gimage['img_border_type'] ) ? $Gimage['img_border_type'] :'solid'; 
$img_title_opacity = isset( $Gimage['img_title_opacity'] ) ? $Gimage['img_title_opacity'] : 75; 
$img_title_color = isset( $Gimage['img_title_color'] ) ? $Gimage['img_title_color'] : '#ffffff'; 
$img_title_font = isset( $Gimage['img_title_font'] ) ? $Gimage['img_title_font'] : 17 ;
$img_title_transform = isset( $Gimage['img_title_transform'] ) ? $Gimage['img_title_transform'] :'uppercase' ;
$img_title_padding = isset( $Gimage['img_title_padding'] ) ? $Gimage['img_title_padding'] :20;
$img_btn_font = isset( $Gimage['img_btn_font'] ) ? $Gimage['img_btn_font'] : 14;
$img_btn_color = isset( $Gimage['img_btn_color'] ) ? $Gimage['img_btn_color'] :'#ffffff';
$img_btn_border = isset( $Gimage['img_btn_border'] ) ? $Gimage['img_btn_border'] :'#ffffff';
//since 2.3.1 load more options
$default_img_load_button = isset( $Gimage['img_load_button'] ) ? $Gimage['img_load_button'] :'enable';
$img_item_number = isset( $Gimage['img_item_number'] ) ? $Gimage['img_item_number'] :10;
$img_load_position = isset( $Gimage['img_load_position'] ) ? $Gimage['img_load_position'] :'full';
$img_load_color = isset( $Gimage['img_load_color'] ) ? $Gimage['img_load_color'] :'#000000';
$img_load_bgcolor = isset( $Gimage['img_load_bgcolor'] ) ? $Gimage['img_load_bgcolor'] :'#cccccc';
$img_load_color_hover = isset( $Gimage['img_load_color_hover'] ) ? $Gimage['img_load_color_hover'] :'#ffffff';
$img_load_bgcolor_hover = isset( $Gimage['img_load_bgcolor_hover'] ) ? $Gimage['img_load_bgcolor_hover'] :'#555555';

 //Youtube gallery options
 if($Gyoutube = get_option('youtube_style')){
$Gyoutube = get_option('youtube_style');
}
$youtube_column = isset( $Gyoutube['youtube_column'] ) ? $Gyoutube['youtube_column'] : 'Three'; 
$you_title_back = isset( $Gyoutube['you_title_back'] ) ? $Gyoutube['you_title_back'] : '#000000';
$youtube_border = isset( $Gyoutube['youtube_border'] )? $Gyoutube['youtube_border'] : 0; 
$youtube_border_color = isset( $Gyoutube['youtube_border_color'] ) ? $Gyoutube['youtube_border_color'] :'#ffffff'; 
$youtube_border_type = isset( $Gyoutube['youtube_border_type'] ) ? $Gyoutube['youtube_border_type'] :'solid'; 
$you_title_opacity = isset( $Gyoutube['you_title_opacity'] ) ? $Gyoutube['you_title_opacity'] : 75; 
$you_title_color = isset( $Gyoutube['you_title_color'] ) ? $Gyoutube['you_title_color'] : '#ffffff'; 
$you_title_font = isset( $Gyoutube['you_title_font'] ) ? $Gyoutube['you_title_font'] : 17 ;
$you_title_transform = isset( $Gyoutube['you_title_transform'] ) ? $Gyoutube['you_title_transform'] :'uppercase' ;
$you_title_padding = isset( $Gyoutube['you_title_padding'] ) ? $Gyoutube['you_title_padding'] : 20;
$you_btn_font = isset( $Gyoutube['you_btn_font'] ) ? $Gyoutube['you_btn_font'] : 14;
$you_btn_color = isset( $Gyoutube['you_btn_color'] ) ? $Gyoutube['you_btn_color'] : '#ffffff';
$you_btn_border = isset( $Gyoutube['you_btn_border'] ) ? $Gyoutube['you_btn_border'] : '#ffffff';
//since 2.3.1 load more options
$you_load_button = isset( $Gyoutube['you_load_button'] ) ? $Gyoutube['you_load_button'] :'enable';
$you_item_number = isset( $Gyoutube['you_item_number'] ) ? $Gyoutube['you_item_number'] :10;
$you_load_position = isset( $Gyoutube['you_load_position'] ) ? $Gyoutube['you_load_position'] :'full';
$you_load_color = isset( $Gyoutube['you_load_color'] ) ? $Gyoutube['you_load_color'] :'#000000';
$you_load_bgcolor = isset( $Gyoutube['you_load_bgcolor'] ) ? $Gyoutube['you_load_bgcolor'] :'#cccccc';
$you_load_color_hover = isset( $Gyoutube['you_load_color_hover'] ) ? $Gyoutube['you_load_color_hover'] :'#ffffff';
$you_load_bgcolor_hover = isset( $Gyoutube['you_load_bgcolor_hover'] ) ? $Gyoutube['you_load_bgcolor_hover'] :'#555555';

 //Vimeo gallery options
 if($Gvimeo = get_option('vimeo_style')){
$Gvimeo = get_option('vimeo_style');
}
$vimeo_title_back = isset( $Gvimeo['vimeo_title_back'] ) ? $Gvimeo['vimeo_title_back'] : '#000000';
$vimeo_border = isset( $Gvimeo['vimeo_border'] ) ? $Gvimeo['vimeo_border'] : 0; 
$vimeo_border_color = isset( $Gvimeo['vimeo_border_color'] ) ? $Gvimeo['vimeo_border_color'] :'#ffffff'; 
$vimeo_border_type = isset( $Gvimeo['vimeo_border_type'] ) ? $Gvimeo['vimeo_border_type'] :'solid';  
$vimeo_title_opacity = isset( $Gvimeo['vimeo_title_opacity'] ) ? $Gvimeo['vimeo_title_opacity'] : 50; 
$vimeo_title_color = isset( $Gvimeo['vimeo_title_color'] ) ? $Gvimeo['vimeo_title_color'] : '#ffffff'; 
$vimeo_title_font = isset( $Gvimeo['vimeo_title_font'] ) ? $Gvimeo['vimeo_title_font'] : 17 ;
$vimeo_title_transform = isset( $Gvimeo['vimeo_title_transform'] ) ? $Gvimeo['vimeo_title_transform'] :'uppercase' ;
$vimeo_title_padding = isset( $Gvimeo['vimeo_title_padding'] ) ? $Gvimeo['vimeo_title_padding'] :20;
$vimeo_btn_font = isset( $Gvimeo['vimeo_btn_font'] ) ? $Gvimeo['vimeo_btn_font'] :14 ;
$vimeo_btn_color = isset( $Gvimeo['vimeo_btn_color'] ) ? $Gvimeo['vimeo_btn_color'] :'#ffffff' ;
$vimeo_btn_border = isset( $Gvimeo['vimeo_btn_border'] ) ? $Gvimeo['vimeo_btn_border'] :'#ffffff' ;
//since 2.3.1 load more options
$vimeo_load_button = isset( $Gvimeo['vimeo_load_button'] ) ? $Gvimeo['vimeo_load_button'] :'enable';
$vimeo_item_number = isset( $Gvimeo['vimeo_item_number'] ) ? $Gvimeo['vimeo_item_number'] :10;
$vimeo_load_position = isset( $Gvimeo['vimeo_load_position'] ) ? $Gvimeo['vimeo_load_position'] :'full';
$vimeo_load_color = isset( $Gvimeo['vimeo_load_color'] ) ? $Gvimeo['vimeo_load_color'] :'#000000';
$vimeo_load_bgcolor = isset( $Gvimeo['vimeo_load_bgcolor'] ) ? $Gvimeo['vimeo_load_bgcolor'] :'#cccccc';
$vimeo_load_color_hover = isset( $Gvimeo['vimeo_load_color_hover'] ) ? $Gvimeo['vimeo_load_color_hover'] :'#ffffff';
$vimeo_load_bgcolor_hover = isset( $Gvimeo['vimeo_load_bgcolor_hover'] ) ? $Gvimeo['vimeo_load_bgcolor_hover'] :'#555555';

 //Soundcloud gallery options
 if($GSound = get_option('Soundcloud_style')){
$GSound = get_option('Soundcloud_style');
}
$sound_title_back = isset( $GSound['sound_title_back'] ) ? $GSound['sound_title_back'] : '#000000';
$soundcloud_border = isset( $GSound['soundcloud_border'] ) ? $GSound['soundcloud_border'] : 0; 
$soundcloud_border_color = isset( $GSound['soundcloud_border_color'] ) ? $GSound['soundcloud_border_color'] :'#ffffff'; 
$soundcloud_border_type = isset( $GSound['soundcloud_border_type'] ) ? $GSound['soundcloud_border_type'] :'solid';  
$sound_title_opacity = isset( $GSound['sound_title_opacity'] ) ? $GSound['sound_title_opacity'] : 75; 
$sound_title_color = isset( $GSound['sound_title_color'] ) ? $GSound['sound_title_color'] : '#ffffff'; 
$sound_title_font = isset( $GSound['sound_title_font'] ) ? $GSound['sound_title_font'] : 17 ;
$sound_title_transform = isset( $GSound['sound_title_transform'] ) ? $GSound['sound_title_transform'] :'uppercase' ;
$sound_title_padding = isset( $GSound['sound_title_padding'] ) ? $GSound['sound_title_padding'] :20;
$sound_btn_font = isset( $GSound['sound_btn_font'] ) ? $GSound['sound_btn_font'] :14;
$sound_btn_color = isset( $GSound['sound_btn_color'] ) ? $GSound['sound_btn_color'] :'#ffffff';
$sound_btn_border = isset( $GSound['sound_btn_border'] ) ? $GSound['sound_btn_border'] :'#ffffff';
//since 2.3.1 load more options
$soundcloud_load_button = isset( $GSound['soundcloud_load_button'] ) ? $GSound['soundcloud_load_button'] :'enable';
$soundcloud_item_number = isset( $GSound['soundcloud_item_number'] ) ? $GSound['soundcloud_item_number'] :10;
$soundcloud_load_position = isset( $GSound['soundcloud_load_position'] ) ? $GSound['soundcloud_load_position'] :'full';
$soundcloud_load_color = isset( $GSound['soundcloud_load_color'] ) ? $GSound['soundcloud_load_color'] :'#000000';
$soundcloud_load_bgcolor = isset( $GSound['soundcloud_load_bgcolor'] ) ? $GSound['soundcloud_load_bgcolor'] :'#cccccc';
$soundcloud_load_color_hover = isset( $GSound['soundcloud_load_color_hover'] ) ? $GSound['soundcloud_load_color_hover'] :'#ffffff';
$soundcloud_load_bgcolor_hover = isset( $GSound['soundcloud_load_bgcolor_hover'] ) ? $GSound['soundcloud_load_bgcolor_hover'] :'#555555';

 //iframe gallery options
 if($Giframe = get_option('iframe_style')){
$Giframe = get_option('iframe_style');
}
$iframe_column = isset( $Giframe['iframe_column'] ) ? $Giframe['iframe_column'] : 'Three'; 
$iframe_border = isset( $Giframe['iframe_border'] ) ? $Giframe['iframe_border'] : 0; 
$iframe_border_color = isset( $Giframe['iframe_border_color'] ) ? $Giframe['iframe_border_color'] :'#ffffff'; 
$iframe_border_type =  isset( $Giframe['iframe_border_type'] ) ? $Giframe['iframe_border_type'] :'solid'; 
$iframe_title_back = isset( $Giframe['iframe_title_back'] ) ? $Giframe['iframe_title_back'] : '#000000'; 
$iframe_title_opacity = isset( $Giframe['iframe_title_opacity'] ) ? $Giframe['iframe_title_opacity'] : 75; 
$iframe_title_color = isset( $Giframe['iframe_title_color'] ) ? $Giframe['iframe_title_color'] : '#ffffff'; 
$iframe_title_font = isset( $Giframe['iframe_title_font'] ) ? $Giframe['iframe_title_font'] : 17 ;
$iframe_title_transform = isset( $Giframe['iframe_title_transform'] ) ? $Giframe['iframe_title_transform'] :'uppercase' ;
$iframe_title_padding = isset( $Giframe['iframe_title_padding'] ) ? $Giframe['iframe_title_padding'] :20;
$iframe_btn_font = isset( $Giframe['iframe_btn_font'] ) ? $Giframe['iframe_btn_font'] :14;
$iframe_btn_color = isset( $Giframe['iframe_btn_color'] ) ? $Giframe['iframe_btn_color'] :'#ffffff';
$iframe_btn_border = isset( $Giframe['iframe_btn_border'] ) ? $Giframe['iframe_btn_border'] :'#ffffff';
//since 2.3.1 load more options
$iframe_load_button = isset( $Giframe['iframe_load_button'] ) ? $Giframe['iframe_load_button'] :'enable';
$iframe_item_number = isset( $Giframe['iframe_item_number'] ) ? $Giframe['iframe_item_number'] :10;
$iframe_load_position = isset( $Giframe['iframe_load_position'] ) ? $Giframe['iframe_load_position'] :'full';
$iframe_load_color = isset( $Giframe['iframe_load_color'] ) ? $Giframe['iframe_load_color'] :'#000000';
$iframe_load_bgcolor = isset( $Giframe['iframe_load_bgcolor'] ) ? $Giframe['iframe_load_bgcolor'] :'#cccccc';
$iframe_load_color_hover = isset( $Giframe['iframe_load_color_hover'] ) ? $Giframe['iframe_load_color_hover'] :'#ffffff';
$iframe_load_bgcolor_hover = isset( $Giframe['iframe_load_bgcolor_hover'] ) ? $Giframe['iframe_load_bgcolor_hover'] :'#555555';

  ?>
<style type="text/css"> 
#boxGallery .You-gallery{
    border: <?php echo esc_attr($youtube_border); ?>px <?php echo esc_attr($youtube_border_type); ?> <?php echo esc_attr($youtube_border_color); ?>;

} 
#boxGallery .Vimeo-gallery{
    border: <?php echo esc_attr($vimeo_border); ?>px <?php echo esc_attr($vimeo_border_type); ?> <?php echo esc_attr($vimeo_border_color); ?>;

} 
#boxGallery .Sound-gallery{
    border: <?php echo esc_attr($soundcloud_border); ?>px <?php echo esc_attr($soundcloud_border_type); ?> <?php echo esc_attr($soundcloud_border_color); ?>;

} 
#boxGallery .iframe-gallery{
   border: <?php echo esc_attr($iframe_border); ?>px <?php echo esc_attr($iframe_border_type); ?> <?php echo esc_attr($iframe_border_color); ?>;

} 
#boxGallery .images-gallery img{
  border: <?php echo esc_attr($img_border); ?>px <?php echo esc_attr($img_border_type); ?> <?php echo esc_attr($img_border_color); ?>;
}
#boxGallery .You-gallery h2::before {
  background: <?php echo esc_attr($you_title_back); ?> none repeat scroll 0 0;
  opacity: 0.<?php echo esc_attr($you_title_opacity); ?>;
}
#boxGallery .You-gallery h2 {
  color: <?php echo esc_attr($you_title_color); ?>;
  font-size: <?php echo esc_attr($you_title_font); ?>px;
  padding: <?php echo esc_attr($you_title_padding); ?>px;
  text-transform: <?php echo esc_attr($you_title_transform); ?>;
} 

#boxGallery .Vimeo-gallery h2::before {
  background: <?php echo esc_attr($vimeo_title_back); ?> none repeat scroll 0 0;
  opacity: 0.<?php echo esc_attr($vimeo_title_opacity); ?>;
}
#boxGallery .Vimeo-gallery h2 {
  color: <?php echo esc_attr($vimeo_title_color); ?>;
  font-size: <?php echo esc_attr($vimeo_title_font); ?>px;
  padding: <?php echo esc_attr($vimeo_title_padding); ?>px;
  text-transform: <?php echo esc_attr($vimeo_title_transform); ?>;
} 

#boxGallery .Sound-gallery h2::before {
  background: <?php echo esc_attr($sound_title_back); ?> none repeat scroll 0 0;
  opacity: 0.<?php echo esc_attr($sound_title_opacity); ?>;
}
#boxGallery .Sound-gallery h2 {
  color: <?php echo esc_attr($sound_title_color); ?>;
  font-size: <?php echo esc_attr($sound_title_font); ?>px;
  padding: <?php echo esc_attr($sound_title_padding); ?>px;
  text-transform: <?php echo esc_attr($sound_title_transform); ?>;
} 

#boxGallery .iframe-gallery h2::before {
  background: <?php echo esc_attr($iframe_title_back); ?> none repeat scroll 0 0;
  opacity: 0.<?php echo esc_attr($iframe_title_opacity); ?>;
}
#boxGallery .iframe-gallery h2 {
  color: <?php echo esc_attr($iframe_title_color); ?>;
  font-size: <?php echo esc_attr($iframe_title_font); ?>px;
  padding: <?php echo esc_attr($iframe_title_padding); ?>px;
  text-transform: <?php echo esc_attr($iframe_title_transform); ?>;
}
 
#boxGallery .images-gallery h2::before {
  background: <?php echo esc_attr($img_title_back); ?> none repeat scroll 0 0;
  opacity: 0.<?php echo esc_attr($img_title_opacity); ?>;
}
#boxGallery .images-gallery h2 {
  color: <?php echo esc_attr($img_title_color); ?>;
  font-size: <?php echo esc_attr($img_title_font); ?>px;
  padding: <?php echo esc_attr($img_title_padding); ?>px;
  text-transform: <?php echo esc_attr($img_title_transform); ?>;
}

#boxGallery .images-gallery .overlay button.info {
  border: 1px solid <?php echo esc_attr($img_btn_border); ?>;
  color: <?php echo esc_attr($img_btn_color); ?>;
   font-size: <?php echo esc_attr($img_btn_font); ?>px;

}

#boxGallery .You-gallery .overlay button.info {
  border: 1px solid <?php echo esc_attr($you_btn_border); ?>;
  color: <?php echo esc_attr($you_btn_color); ?>;
  font-size: <?php echo esc_attr($you_btn_font); ?>px;
}

#boxGallery .Vimeo-gallery .overlay button.info {
  border: 1px solid <?php echo esc_attr($vimeo_btn_border); ?>;
  color: <?php echo esc_attr($vimeo_btn_color); ?>;
  font-size: <?php echo esc_attr($vimeo_btn_font); ?>px;

}

#boxGallery .Sound-gallery .overlay button.info {
  border: 1px solid <?php echo esc_attr($sound_btn_border); ?>;
  color: <?php echo esc_attr($sound_btn_color); ?>;
  font-size: <?php echo esc_attr($sound_btn_font); ?>px;

}

#boxGallery .iframe-gallery .overlay button.info {
  border: 1px solid <?php echo esc_attr($iframe_btn_border); ?>;
  color: <?php echo esc_attr($iframe_btn_color); ?>;
  font-size: <?php echo esc_attr($iframe_btn_font); ?>px;

}
<?php
/*image Load more button style*/
 
    global $post;
				//Query args
		$args = array(
		'post_type'  		=>	'gallery_box',
		'posts_per_page' 	=> -1,
		);
	//start WP_Query
	$loop= new WP_Query($args);
    while ( $loop->have_posts()) :  $loop->the_post();
	$post_ID = $post->ID;
    $settings_main = get_post_meta(get_the_ID(), 'settings_main', true);
    $uniqe_loadmore =  !empty( $settings_main[0]['uniqe_loadmore'])  ? $settings_main[0]['uniqe_loadmore'] : 'default';
    $layout_type =  !empty( $settings_main[0]['layout_type'])  ? $settings_main[0]['layout_type'] : 'n_gallery';
    $img_height =  !empty( $settings_main[0]['img_height'])  ? $settings_main[0]['img_height'] : 'auto_height';
    $img_custom_height =  !empty( $settings_main[0]['img_custom_height'])  ? $settings_main[0]['img_custom_height'] : 0;
    $img_right_margin =  !empty( $settings_main[0]['img_right_margin'])  ? $settings_main[0]['img_right_margin'] : 0;
    $img_bottom_margin =  !empty( $settings_main[0]['img_bottom_margin'])  ? $settings_main[0]['img_bottom_margin'] : 0;
    $custom_css =  !empty( $settings_main[0]['custom_css'])  ? $settings_main[0]['custom_css'] : '#boxGallery {letter-spacing: 2px;}';
    
    //load more button
    
        if($uniqe_loadmore !=='default'){ 
            $img_load_button = $uniqe_loadmore;
        }else{ 
            $img_load_button = $default_img_load_button;
        } ?>
        
.gcolumn-1 .gbox-margin<?php echo esc_attr($post_ID); ?>.hover{ 
    width:100%;
}
<?php if($img_height == 'custom_height' && $layout_type == 'n_gallery'): ?>
#boxGallery.g-box9 img{ 
    height:<?php echo esc_attr($img_custom_height); ?>px;
}
<?php endif; ?>
<?php if($img_right_margin >= 1 || $img_bottom_margin >= 1): ?>
#boxGallery .gbox-margin<?php echo esc_attr($post_ID); ?>{ 
    margin-bottom: <?php echo esc_attr($img_bottom_margin); ?>px;
    margin-right: <?php echo esc_attr($img_right_margin); ?>px;
}
@media only screen and (max-width: 767px) {
   #boxGallery .gbox-margin<?php echo esc_attr($post_ID); ?>{ 
    margin-right: 0;
}
}
<?php endif; ?>       
 <?php if($img_load_button=='enable'):
 ?>
 
 
.images-gallery<?php echo esc_attr($post_ID); ?> {
    display:none;
}

.img-load<?php echo esc_attr($post_ID); ?> button#loadMore<?php echo esc_attr($post_ID); ?> {
    background: <?php echo esc_attr($img_load_bgcolor); ?> none repeat scroll 0 0;
    border: medium none;
    border-radius: 2px;
    color: <?php echo esc_attr($img_load_color); ?>;
    margin: 20px 0 0;
}
.img-load<?php echo esc_attr($post_ID); ?> button#loadMore<?php echo esc_attr($post_ID); ?>:hover {
    background: <?php echo esc_attr($img_load_bgcolor_hover); ?> none repeat scroll 0 0;
    color: <?php echo esc_attr($img_load_color_hover); ?>;
}
<?php if($img_load_position=='full'): ?>
.gbox-loadMore.img-load<?php echo esc_attr($post_ID); ?> button{ 
    width:100%;
}
<?php else: ?>
.gbox-loadMore.img-load<?php echo esc_attr($post_ID); ?> { 
    text-align:<?php echo esc_attr($img_load_position); ?>;
}
 <?php endif; endif; ?>
<?php echo esc_attr($custom_css); ?> 
<?php endwhile; ?> 
<?php wp_reset_postdata(); ?>
<?php  
//Load more end
//youtube load more button style
?>

<?php if($you_load_button=='enable'): ?>
.You-gallery {
    display:none;
}
.you-load button#youMore {
    background: <?php echo esc_attr($you_load_bgcolor); ?> none repeat scroll 0 0;
    border: medium none;
    border-radius: 2px;
    color: <?php echo esc_attr($you_load_color); ?>;
    margin: 20px 0 0;
}
.you-load button#youMore:hover {
    background: <?php echo esc_attr($you_load_bgcolor_hover); ?> none repeat scroll 0 0;
    color: <?php echo esc_attr($you_load_color_hover); ?>;
}
<?php if($you_load_position=='full'): ?>
.gbox-loadMore.you-load button{ 
    width:100%;
}
<?php else: ?>
.gbox-loadMore.you-load { 
    text-align:<?php echo esc_attr($you_load_position); ?>;
}
 <?php endif; ?>
<?php endif; ?>

<?php
/* vimeo Load more button style*/
 if($vimeo_load_button=='enable'): ?>
.Vimeo-gallery {
    display:none;
}

.vimeo-load button#vimeoMore {
    background: <?php echo esc_attr($vimeo_load_bgcolor); ?> none repeat scroll 0 0;
    border: medium none;
    border-radius: 2px;
    color: <?php echo esc_attr($vimeo_load_color); ?>;
    margin: 20px 0 0;
}
.vimeo-load button#vimeoMore:hover {
    background: <?php echo esc_attr($vimeo_load_bgcolor_hover); ?> none repeat scroll 0 0;
    color: <?php echo esc_attr($vimeo_load_color_hover); ?>;
}
<?php if($vimeo_load_position=='full'): ?>
.gbox-loadMore.vimeo-load button{ 
    width:100%;
}
<?php else: ?>
.gbox-loadMore.vimeo-load { 
    text-align:<?php echo esc_attr($vimeo_load_position); ?>;
}
 <?php endif; ?>
<?php endif; 
//Load more end
?>
<?php
/*Sound load more button*/
 if($soundcloud_load_button=='enable'): ?>
.Sound-gallery {
    display:none;
}

.sound-load button#soundMore {
    background: <?php echo esc_attr($soundcloud_load_bgcolor); ?> none repeat scroll 0 0;
    border: medium none;
    border-radius: 2px;
    color: <?php echo esc_attr($soundcloud_load_color); ?>;
    margin: 20px 0 0;
}
.sound-load button#soundMore:hover {
    background: <?php echo esc_attr($soundcloud_load_bgcolor_hover); ?> none repeat scroll 0 0;
    color: <?php echo esc_attr($soundcloud_load_color_hover); ?>;
}
<?php if($soundcloud_load_position=='full'): ?>
.gbox-loadMore.sound-load button{ 
    width:100%;
}
<?php else: ?>
.gbox-loadMore.sound-load { 
    text-align:<?php echo esc_attr($soundcloud_load_position); ?>;
}
 <?php endif; ?>
<?php endif; 
//Load more end
?>
<?php
/*Load more button*/
 if($iframe_load_button=='enable'): ?>
.iframe-gallery {
    display:none;
}

.iframe-load button#iframeMore {
    background: <?php echo esc_attr($iframe_load_bgcolor); ?> none repeat scroll 0 0;
    border: medium none;
    border-radius: 2px;
    color: <?php echo esc_attr($iframe_load_color); ?>;
    margin: 20px 0 0;
}
.iframe-load button#iframeMore:hover {
    background: <?php echo esc_attr($iframe_load_bgcolor_hover); ?> none repeat scroll 0 0;
    color: <?php echo esc_attr($iframe_load_color_hover); ?>;
}
<?php if($iframe_load_position=='full'): ?>
.gbox-loadMore.iframe-load button{ 
    width:100%;
}
<?php else: ?>
.gbox-loadMore.img-load { 
    text-align:<?php echo esc_attr($iframe_load_position); ?>;
}
 <?php endif; ?>
<?php endif; 
//Load more end
?>



</style>
<?php 
}
 add_action('wp_head','gbox_style_add',99);
endif;

 if ( ! function_exists( 'gbox_scripts_add' ) ) :
 function gbox_scripts_add(){
  //image gallery options
 if($Gimage = get_option('img_style')){
$Gimage = get_option('img_style');
}
//youtube gallery options
 if($Gyoutube = get_option('youtube_style')){
$Gyoutube = get_option('youtube_style');
}
//vimeo gallery options
 if($Gvimeo = get_option('vimeo_style')){
$Gvimeo = get_option('vimeo_style');
}
//soundcloud gallery options
if($GSound = get_option('Soundcloud_style')){
$GSound = get_option('Soundcloud_style');
}
//iframe gallery options
 if($Giframe = get_option('iframe_style')){
$Giframe = get_option('iframe_style');
}
//lightbox options
  if($Lightbox = get_option('Lightbox_settings')){
$Lightbox = get_option('Lightbox_settings');
}
$loader_on = isset( $Lightbox['loader_on'] ) ? $Lightbox['loader_on'] : 'yes'; 
$overlayColor = isset( $Lightbox['overlayColor'] ) ? $Lightbox['overlayColor'] : '#ff0000'; 
$overlayOpacity = isset( $Lightbox['overlayOpacity'] ) ? $Lightbox['overlayOpacity'] : 60; 
$fadeSpeed = isset( $Lightbox['fadeSpeed'] ) ? $Lightbox['fadeSpeed'] : 300; 
$useCaption = isset( $Lightbox['useCaption'] ) ? $Lightbox['useCaption'] : 'yes'; 
$useNav = isset( $Lightbox['useNav'] ) ? $Lightbox['useNav'] : 'yes'; 
//since 1.3.0 image loadMore
$default_img_load_button = isset( $Gimage['img_load_button'] ) ? $Gimage['img_load_button'] :'enable';
$img_item_number = isset( $Gimage['img_item_number'] ) ? $Gimage['img_item_number'] :10;
//since 1.3.0 youtube loadMore
$you_load_button = isset( $Gyoutube['you_load_button'] ) ? $Gyoutube['you_load_button'] :'enable';
$you_item_number = isset( $Gyoutube['you_item_number'] ) ? $Gyoutube['you_item_number'] :10;
//since 1.3.0 vimeo loadMore
$vimeo_load_button = isset( $Gvimeo['vimeo_load_button'] ) ? $Gvimeo['vimeo_load_button'] :'enable';
$vimeo_item_number = isset( $Gvimeo['vimeo_item_number'] ) ? $Gvimeo['vimeo_item_number'] :10;
//since 2.3.1 soundcloud more options
$soundcloud_load_button = isset( $GSound['soundcloud_load_button'] ) ? $GSound['soundcloud_load_button'] :'enable';
$soundcloud_item_number = isset( $GSound['soundcloud_item_number'] ) ? $GSound['soundcloud_item_number'] :10;
//since 2.3.1  iframe load more options
$iframe_load_button = isset( $Giframe['iframe_load_button'] ) ? $Giframe['iframe_load_button'] :'enable';
$iframe_item_number = isset( $Giframe['iframe_item_number'] ) ? $Giframe['iframe_item_number'] :10;
  ?>
	<script type="text/javascript">
		(function ($) {
			"use strict";
			$(document).ready(function(){
            <?php
			global $post;
				//Query args
		$args = array(
		'post_type'  		=>	'gallery_box',
		'posts_per_page' 	=> -1,
		);
	//start WP_Query
	$loop= new WP_Query($args);
    while ( $loop->have_posts()) :  $loop->the_post();
	$post_ID = $post->ID;
    $settings_main = get_post_meta(get_the_ID(), 'settings_main', true);
    $uniqe_loadmore =  !empty( $settings_main[0]['uniqe_loadmore'])  ? $settings_main[0]['uniqe_loadmore'] : 'default';
    $layout_type =  !empty( $settings_main[0]['layout_type'])  ? $settings_main[0]['layout_type'] : 'n_gallery';
    $img_custom_height =  !empty( $settings_main[0]['img_custom_height'])  ? $settings_main[0]['img_custom_height'] : 0;

    
    //load more button
    
        if($uniqe_loadmore !=='default'){ 
            $img_load_button = $uniqe_loadmore;
        }else{ 
            $img_load_button = $default_img_load_button;
        }

    ?>
            
					var foo = $('.g-box<?php echo esc_attr($post_ID); ?> ');
						foo.poptrox({
							usePopupCaption: <?php if($useCaption=='yes'): ?>true<?php else: ?>false<?php endif; ?>,
							fadeSpeed:       <?php echo esc_attr($fadeSpeed); ?>,
							overlayColor:   '<?php echo esc_attr($overlayColor); ?>',
							usePopupLoader:   <?php if($loader_on=='yes'): ?>true<?php else: ?>false<?php endif; ?>,
							overlayOpacity:   0.<?php echo esc_attr($overlayOpacity); ?>,
							usePopupCloser:    true,
							usePopupNav:        <?php if($useNav=='yes'): ?>true<?php else: ?>false<?php endif; ?>,
                            selector: 'div .gclick', 
						});
                        <?php if($layout_type == 'j_gallery'): ?>
                        /*justify gallery active since 1.4.0*/
                        $('.g-box<?php echo esc_attr($post_ID); ?>').justifiedGallery({
                            rowHeight : <?php echo esc_attr($img_custom_height); ?>,
                            lastRow : 'nojustify',
                            margins : 0
                        });
                        <?php endif; ?>
                        <?php if($img_load_button=='enable'):
                       /* since 1.3.1
                        image load more button
                       */
                        ?>
                         $(".images-gallery<?php echo esc_attr($post_ID); ?> ").slice(0, <?php echo esc_attr($img_item_number); ?>).show();
                            $("#loadMore<?php echo esc_attr($post_ID); ?>").on('click', function (e) {
                                e.preventDefault();
                                $(".images-gallery<?php echo esc_attr($post_ID); ?>:hidden").slice(0, <?php echo esc_attr($img_item_number); ?>).slideDown();
                                if ($(".images-gallery<?php echo esc_attr($post_ID); ?>:hidden").length == 0) {
                                    $("#loadMore<?php echo esc_attr($post_ID); ?>").fadeOut('slow');
                                }
                                $('html,body').animate({
                                    scrollTop: $(this).offset().top
                                }, 1000);
                            });
                            <?php endif; ?>
                            <?php if($you_load_button=='enable'):
                       /* since 1.3.1
                        Youtube load more button
                       */
                        ?>
                         $(".You-gallery<?php echo esc_attr($post_ID); ?><?php echo esc_attr($post_ID); ?> ").slice(0, <?php echo esc_attr($you_item_number); ?>).show();
                            $("#youMore<?php echo esc_attr($post_ID); ?>").on('click', function (e) {
                                e.preventDefault();
                                $(".You-gallery<?php echo esc_attr($post_ID); ?>:hidden").slice(0, <?php echo esc_attr($you_item_number); ?>).slideDown();
                                if ($(".You-gallery<?php echo esc_attr($post_ID); ?>:hidden").length == 0) {
                                    $("#youMore<?php echo esc_attr($post_ID); ?>").fadeOut('slow');
                                }
                                $('html,body').animate({
                                    scrollTop: $(this).offset().top
                                }, 1000);
                            });
                            <?php endif; ?>
                            <?php if($vimeo_load_button=='enable'):
                       /* since 1.3.1
                        Vimeo load more button
                       */
                        ?>
                         $(".Vimeo-gallery<?php echo esc_attr($post_ID); ?> ").slice(0, <?php echo esc_attr($vimeo_item_number); ?>).show();
                            $("#vimeoMore<?php echo esc_attr($post_ID); ?>").on('click', function (e) {
                                e.preventDefault();
                                $(".Vimeo-gallery<?php echo esc_attr($post_ID); ?>:hidden").slice(0, <?php echo esc_attr($vimeo_item_number); ?>).slideDown();
                                if ($(".Vimeo-gallery<?php echo esc_attr($post_ID); ?>:hidden").length == 0) {
                                    $("#vimeoMore<?php echo esc_attr($post_ID); ?>").fadeOut('slow');
                                }
                                $('html,body').animate({
                                    scrollTop: $(this).offset().top
                                }, 1000);
                            });
                            <?php endif; ?>
                            <?php if($soundcloud_load_button=='enable'):
                       /* since 1.3.1
                        sound cloud load more button
                       */
                        ?>
                         $(".Sound-gallery<?php echo esc_attr($post_ID); ?> ").slice(0, <?php echo esc_attr($soundcloud_item_number); ?>).show();
                            $("#soundMore<?php echo esc_attr($post_ID); ?>").on('click', function (e) {
                                e.preventDefault();
                                $(".Sound-gallery<?php echo esc_attr($post_ID); ?>:hidden").slice(0, <?php echo esc_attr($soundcloud_item_number); ?>).slideDown();
                                if ($(".Sound-gallery<?php echo esc_attr($post_ID); ?>:hidden").length == 0) {
                                    $("#soundMore<?php echo esc_attr($post_ID); ?>").fadeOut('slow');
                                }
                                $('html,body').animate({
                                    scrollTop: $(this).offset().top
                                }, 1000);
                            });
                            <?php endif; ?>
                            <?php if($iframe_load_button=='enable'):
                       /* since 1.3.1
                        iframe load more button
                       */
                        ?>
                         $(".iframe-gallery<?php echo esc_attr($post_ID); ?> ").slice(0, <?php echo esc_attr($iframe_item_number); ?>).show();
                            $("#iframeMore<?php echo esc_attr($post_ID); ?>").on('click', function (e) {
                                e.preventDefault();
                                $(".iframe-gallery<?php echo esc_attr($post_ID); ?>:hidden").slice(0, <?php echo esc_attr($iframe_item_number); ?>).slideDown();
                                if ($(".iframe-gallery<?php echo esc_attr($post_ID); ?>:hidden").length == 0) {
                                    $("#iframeMore<?php echo esc_attr($post_ID); ?>").fadeOut('slow');
                                }
                                $('html,body').animate({
                                    scrollTop: $(this).offset().top
                                }, 1000);
                            });
                            <?php endif; ?>
             <?php endwhile; ?> 
             <?php wp_reset_postdata(); ?>
			  });
		}(jQuery));	
    </script>
<?php 
}
 add_action('wp_footer','gbox_scripts_add',99);
endif;
