balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

thumbnail-gallery.php (2187B)


      1 <?php
      2 $appside = Appside();
      3 $post_meta = get_post_meta(get_the_ID(),'appside_post_gallery_options',true);
      4 $post_meta_gallery = isset($post_meta['gallery_images']) && !empty($post_meta['gallery_images']) ? $post_meta['gallery_images'] : '';
      5 $gallery_image = explode(',',$post_meta_gallery);
      6 $blog_single_options = Appside_Group_Fields_Value::post_meta('blog_single_post');
      7 ?>
      8 <?php
      9 if ( isset($post_meta['gallery_images']) && !empty($post_meta['gallery_images']) ):
     10 	?>
     11 	<div id="appside_post_gallery" class="carousel slide thumb" data-ride="carousel">
     12 		<div class="time">
     13 			<span class="date"><?php echo esc_html(get_the_date('d'))?></span>
     14 			<span class="month"><?php echo esc_html(get_the_date('M'))?></span>
     15 		</div>
     16 		<ol class="carousel-indicators">
     17 			<?php
     18 			for ($i =0; $i < count($gallery_image); $i++){
     19 				$class = 0 == $i ? 'active' : '';
     20 				printf('<li data-target="#appside_post_gallery" data-slide-to="%2$s" class="%1$s"></li>',esc_attr($i),esc_attr($class));
     21 			}
     22 			?>
     23 		</ol>
     24 		<div class="carousel-inner">
     25 			<?php
     26 			for ($i=0; $i < count($gallery_image); $i++):
     27 				$class = 0 == $i ? 'active' : '';
     28 				$img_src = wp_get_attachment_image_src($gallery_image[$i],'appside_classic');
     29 				$img_alt = get_post_meta($gallery_image[$i],'wp_attachment_image_alt',true);
     30 				?>
     31 				<div class="carousel-item <?php echo esc_attr($class);?>">
     32 					<img class="d-block w-100" src="<?php echo esc_url($img_src[0]);?>" alt="<?php echo esc_attr($img_alt);?>">
     33 				</div>
     34 			<?php endfor; ?>
     35 		</div>
     36 		<a class="carousel-control-prev" href="#appside_post_gallery" role="button" data-slide="prev">
     37 			<span class="carousel-control-prev-icon" aria-hidden="true"></span>
     38 		</a>
     39 		<a class="carousel-control-next" href="#appside_post_gallery" role="button" data-slide="next">
     40 			<span class="carousel-control-next-icon" aria-hidden="true"></span>
     41 		</a>
     42 	</div>
     43 <?php
     44 else:
     45 	if ( has_post_thumbnail() ):
     46 		?>
     47 		<div class="thumb">
     48 			<div class="time">
     49 				<span class="date"><?php echo esc_html(get_the_date('d'))?></span>
     50 				<span class="month"><?php echo esc_html(get_the_date('M'))?></span>
     51 			</div>
     52 			<?php $appside->post_thumbnail(); ?>
     53 		</div>
     54 	<?php
     55 	endif;
     56 endif;
     57 ?>