<?php
/**
* Template part for displaying posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package arsha
*/
$categories = get_the_terms( $post->ID, 'category' );
$arsha_blog_cat = get_theme_mod( 'arsha_blog_cat', false );
$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-search' );?>>
<?php if ( has_post_thumbnail() ): ?>
<div class="mt-postbox-thumb">
<?php the_post_thumbnail( 'full', ['class' => 'img-responsive'] );?>
</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: ?>
<article id="post-<?php the_ID();?>" <?php post_class( 'mt-postbox mb-60 format-search' );?>>
<?php if(has_post_thumbnail()) : ?>
<div class="mt-postbox-thumb">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('full'); ?>
</a>
</div>
<?php endif; ?>
<div class="mt-postbox-content">
<!-- blog meta -->
<?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 mb-25">
<?php the_excerpt(); ?>
</div>
<!-- blog btn -->
<?php get_template_part( 'template-parts/blog/blog-btn' ); ?>
</div>
</article>
<?php endif;?>