/home/moonrcjl/public_html/wp/wp-content/themes/arsha/template-parts/content-gallery.php
 <?php
/**
 * Template part for displaying posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package arsha
 */

$gallery_images = function_exists('tpmeta_gallery_field')? tpmeta_gallery_field('arsha_post_gallery') : '';

$arsha_social_share_switch = get_theme_mod( 'arsha_social_share_switch', false );
$tag_col_number= $arsha_social_share_switch ? "col-lg-7" : "col-12";

if ( is_single() ): ?>

 <article id="post-<?php the_ID();?>" <?php post_class( 'mt-postbox mb-60 format-gallery' );?>>
     <?php if ( !empty( $gallery_images ) ): ?>
     <div class="mt-postbox-thumb p-relative">
         <div class="swiper mt-blog-active">
             <div class="swiper-wrapper">
                 <?php foreach ( $gallery_images as $key => $image ): ?>
                 <div class="swiper-slide">
                     <img src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_url($image['alt']); ?>">
                 </div>
                 <?php endforeach;?>
             </div>
         </div>

         <div class="mt-blog-slider-arrow">
             <div class="mt-swiper-blog-button-prev mt-swiper-blog-button">
                 <i class="fa-regular fa-arrow-left-long"></i>
             </div>
             <div class="mt-swiper-blog-button-next mt-swiper-blog-button">
                 <i class="fa-regular fa-arrow-right-long"></i>
             </div>
         </div>
     </div>
     <?php endif; ?>
     <div class="mt-postbox-content mb-50">
         <!-- Blog Meta -->
         <?php get_template_part( 'template-parts/blog/blog-meta' ); ?>
         <h3 class="mt-postbox-title mt-fs-40 mb-30"><?php the_title(); ?></h3>
         <div class="mt-postbox-details">
             <?php the_content(); ?>
             <div class="mt-postbox-tag-wrapper mt-50">
                 <div class="row align-items-center">
                     <div class="<?php echo esc_attr($tag_col_number); ?>">
                         <div class="mt-postbox-tag mb-30">
                             <span><?php echo esc_html__('Tag:','arsha'); ?></span>
                             <?php
                                 $tags = get_the_tags(); // Assuming you are within the loop
                                 if ($tags) {
                                    
                                    foreach ($tags as $tag) {
                                          echo '<a href="' . get_tag_link($tag->term_id) . '">' . $tag->name . '</a>';
                                    }
                                 }
                              ?>
                         </div>
                     </div>
                     <?php if(function_exists('arsha_blog_social_share') && !empty($arsha_social_share_switch)) : ?>
                     <div class="col-lg-5">
                         <div class="mt-postbox-social mb-30 text-start text-lg-end">
                             <?php arsha_blog_social_share(); ?>
                         </div>
                     </div>
                     <?php endif; ?>
                 </div>
             </div>
         </div>
     </div>
 </article>

 <?php else: 
    $categories = get_the_terms( $post->ID, 'category' );    
    $arsha_blog_cat = get_theme_mod( 'arsha_blog_cat', false );
?>

 <article id="post-<?php the_ID();?>" <?php post_class( 'mt-postbox mb-60 format-gallery' );?>>
     <?php if ( !empty( $gallery_images ) ): ?>
     <div class="mt-postbox-thumb p-relative">
         <div class="swiper mt-blog-active">
             <div class="swiper-wrapper">
                 <?php foreach ( $gallery_images as $key => $image ): ?>
                 <div class="swiper-slide">
                     <img src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_url($image['alt']); ?>">
                 </div>
                 <?php endforeach;?>
             </div>
         </div>

         <div class="mt-blog-slider-arrow">
             <div class="mt-swiper-blog-button-prev mt-swiper-blog-button">
                 <i class="fa-regular fa-arrow-left-long"></i>
             </div>
             <div class="mt-swiper-blog-button-next mt-swiper-blog-button">
                 <i class="fa-regular fa-arrow-right-long"></i>
             </div>
         </div>
     </div>
     <?php endif; ?>
     <div class="mt-postbox-content">
         <?php get_template_part( 'template-parts/blog/blog-meta' ); ?>

         <h3 class="mt-postbox-title mb-20"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>

         <div class="postbox__text">
             <?php the_excerpt(); ?>
         </div>

         <!-- blog btn -->
         <?php get_template_part( 'template-parts/blog/blog-btn' ); ?>
     </div>
 </article>

 <?php
endif;?>