<?php
/**
 * The template part for displaying content
 * @package Ultimate Blogger
 * @subpackage multipurpose_blog
 * @since 1.0
 */
?>
<?php 
  $archive_year  = get_the_time('Y'); 
  $archive_month = get_the_time('m'); 
  $archive_day   = get_the_time('d'); 
?>
<article class="main-box text-start mb-4 p-3 mainbox">
  <div class="layout2"> 
    <div class="cat-box text-start m-0 pt-0">
      <?php foreach((get_the_category()) as $category) { echo esc_html($category->cat_name) . ' '; } ?>           
    </div>
    <a href="<?php the_permalink(); ?>"><h2 class="text-start p-0 m-0"><?php the_title(); ?></h2><span class="screen-reader-text"><?php the_title(); ?></span></a>
    <?php if( get_theme_mod( 'multipurpose_blog_metafields_date',true) != '') { ?>
      <div class="date-box text-start m-0"><i class="<?php echo esc_attr(get_theme_mod('multipurpose_blog_post_date_icon','far fa-calendar-alt')); ?> me-2"></i><a href="<?php echo esc_url( get_day_link( $archive_year, $archive_month, $archive_day)); ?>"><?php the_time( get_option( 'date_format' ) ); ?><span class="screen-reader-text"><?php echo esc_html( get_the_date() ); ?></span></a></div>
    <?php }?>
    <div class="main_image text-start mb-2">
      <?php if(has_post_thumbnail()) { ?><?php the_post_thumbnail(); ?><?php } ?>
    </div>
    <?php $multipurpose_blog_theme_lay = get_theme_mod( 'multipurpose_blog_content_settings','Excerpt');
    if($multipurpose_blog_theme_lay == 'Content'){ ?>
      <?php the_content(); ?>
    <?php }
    if($multipurpose_blog_theme_lay == 'Excerpt'){ ?>
      <?php if(get_the_excerpt()) { ?>
        <p class="text-start"><?php $ultimate_blogger_excerpt = get_the_excerpt(); echo esc_html( multipurpose_blog_string_limit_words( $ultimate_blogger_excerpt, esc_attr(get_theme_mod('multipurpose_blog_post_excerpt_number','30')))); ?><?php echo esc_html( get_theme_mod('multipurpose_blog_post_discription_suffix','[...]') ); ?></p>
      <?php }?>
    <?php }?>
    <div class="blogbtn text-start mt-3">
      <a href="<?php echo esc_url( get_permalink() );?>" class="blogbutton-small hvr-sweep-to-right"><?php esc_html_e('Read Full','ultimate-blogger'); ?>
      <span class="screen-reader-text"><?php esc_html_e( 'Read Full', 'ultimate-blogger' );?></span></a>
    </div>
  </div>
</article>