balmet.com

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

content-gallery.php (2956B)


      1 <?php
      2 /**
      3  * Template part for displaying posts
      4  *
      5  * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
      6  *
      7  * @package appside
      8  */
      9 $appside = Appside();
     10 $post_meta = get_post_meta(get_the_ID(),'appside_post_gallery_options',true);
     11 $post_meta_gallery = isset($post_meta['gallery_images']) && !empty($post_meta['gallery_images']) ? $post_meta['gallery_images'] : '';
     12 $gallery_image = explode(',',$post_meta_gallery);
     13 ?>
     14 
     15 <article id="post-<?php the_ID(); ?>" <?php post_class('single-blog-classic-item margin-bottom-30'); ?>>
     16 
     17 	<?php
     18 	if ( isset($post_meta['gallery_images']) && !empty($post_meta['gallery_images']) ):
     19 		?>
     20         <div id="appside_post_gallery" class="carousel slide thumb" data-ride="carousel">
     21         	<div class="time">
     22 				<span class="date"><?php echo esc_html(get_the_date('d'))?></span>
     23 				<span class="month"><?php echo esc_html(get_the_date('M'))?></span>
     24 			</div>
     25             <ol class="carousel-indicators">
     26 				<?php
     27 				for ($i =0; $i < count($gallery_image); $i++){
     28 					$class = 0 == $i ? 'active' : '';
     29 					printf('<li data-target="#appside_post_gallery" data-slide-to="%2$s" class="%1$s"></li>',esc_attr($i),esc_attr($class));
     30 				}
     31 				?>
     32             </ol>
     33             <div class="carousel-inner">
     34 				<?php
     35 
     36 				for ($i=0; $i < count($gallery_image); $i++):
     37 					$class = 0 == $i ? 'active' : '';
     38 					$img_src = wp_get_attachment_image_src($gallery_image[$i],'appside_classic');
     39 					$img_alt = get_post_meta($gallery_image[$i],'wp_attachment_image_alt',true);
     40 					?>
     41                     <div class="carousel-item <?php echo esc_attr($class);?>">
     42                         <img class="d-block w-100" src="<?php echo esc_url($img_src[0]);?>" alt="<?php echo esc_attr($img_alt);?>">
     43                     </div>
     44 				<?php endfor; ?>
     45             </div>
     46             <a class="carousel-control-prev" href="#appside_post_gallery" role="button" data-slide="prev">
     47                 <span class="carousel-control-prev-icon" aria-hidden="true"></span>
     48             </a>
     49             <a class="carousel-control-next" href="#appside_post_gallery" role="button" data-slide="next">
     50                 <span class="carousel-control-next-icon" aria-hidden="true"></span>
     51             </a>
     52         </div>
     53 	<?php
     54 	else:
     55 		if ( has_post_thumbnail() ):
     56 			?>
     57             <div class="thumb">
     58 	            <?php $appside->post_thumbnail(); ?>
     59 	            <div class="time">
     60 					<span class="date"><?php echo esc_html(get_the_date('d'))?></span>
     61 					<span class="month"><?php echo esc_html(get_the_date('M'))?></span>
     62 				</div>
     63             </div>
     64 		<?php
     65 		endif;
     66 	endif;
     67 	?>
     68     <div class="content">
     69       <?php
     70         get_template_part('template-parts/common/post-meta');
     71         the_title( '<h2 class="title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
     72         get_template_part('template-parts/common/post-excerpt');
     73         ?>
     74     </div>
     75 </article><!-- #post-<?php the_ID(); ?> -->