<?php
/**
 * Template part for displaying posts
 * 
 * @subpackage chalak-driving-school
 * @since 1.0
 * @version 1.4
 */
?>
<?php 
  $archive_year  = get_the_time('Y'); 
  $archive_month = get_the_time('m'); 
  $archive_day   = get_the_time('d'); 
?>
<?php
  $content = apply_filters( 'the_content', get_the_content() );
  $video = false;

  // Only get video from the content if a playlist isn't present.
  if ( false === strpos( $content, 'wp-playlist-script' ) ) {
    $video = get_media_embedded_in_content( $content, array( 'video', 'object', 'embed', 'iframe' ) );
  }
?>
<div id="post-<?php the_ID(); ?>" <?php post_class('inner-service'); ?>>
  <div class="article_content">   
    <div class="article-text">
      <h2><?php the_title(); ?></h2>   
      <?php
        if ( ! is_single() ) {
          // If not a single post, highlight the video file.
          if ( ! empty( $video ) ) {
            foreach ( $video as $video_html ) {
              echo '<div class="entry-video">';
                echo $video_html;
              echo '</div>';
            }
          };
        }; 
      ?>
      <div class="metabox">
        <a href="<?php echo esc_url( get_day_link( $archive_year, $archive_month, $archive_day)); ?>"><span class="entry-date"><?php the_time( get_option( 'date_format' ) ); ?></span><span class="screen-reader-text"><?php the_time( get_option( 'date_format' ) ); ?></span></a>
        <a href="<?php echo esc_url( get_permalink() );?>"><span class="entry-author"><?php the_author(); ?></span></a>
        <span class="entry-comments"><?php comments_number( __('0 Comments','chalak-driving-school'), __('0 Comments','chalak-driving-school'), __('% Comments','chalak-driving-school') ); ?></span>
      </div>
      <div class="text-content"><p><?php $excerpt = get_the_excerpt();echo esc_html( chalak_driving_school_string_limit_words( $excerpt,30 ) ); ?></p></div>
      <div class="read-btn">
        <a href="<?php echo esc_url( get_permalink() );?>" class="blogbutton-small" title="<?php esc_attr_e( 'READ MORE', 'chalak-driving-school' ); ?>"><?php esc_html_e('READ MORE','chalak-driving-school'); ?><i class="fas fa-angle-right"></i>
        </a>
      </div>
    </div>
    <div class="clearfix"></div> 
  </div>
</div>