<?php
/**
 * The template for displaying pages in a simple way for search results
 */
if ( ! defined( 'ABSPATH' ) ) {
	exit();
}
?>
<div <?php post_class('blog-article'); ?>>
     <?php
    $embeds = null;
    if (has_post_format('video') || has_post_format('audio')) {
        $content = do_shortcode(apply_filters('the_content', get_the_content()));
        $embeds = get_media_embedded_in_content($content);
    }

    if (has_post_thumbnail() || $embeds != null) {
        ?>
    <div class='blog-article-thumbnail'>
            <?php if ($embeds != null) { ?>
                <div <?php
                if (has_post_format('video')) {
                    echo 'class="embed-responsive embed-responsive-16by9"';
                }
                ?>>
                        <?php print $embeds[0]; ?>
                </div>
                <?php
            } else { $post_id = get_the_ID();
                $image_data = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'milo_blog1col_size');
                ?>
                <img src='<?php echo esc_url($image_data[0]); ?>' alt=''>
          <?php } ?>
        </div>
    <?php } ?>	

    <div class="blog-article-date"><?php echo get_the_date('d M, Y'); ?></div>

    <div class="blog-article-details">

        <h5><?php the_title(); ?></h5>

        <p>

            <?php
            esc_html_e('By ', 'dakota-theme');
            the_author();
            ?> | <?php the_category(', '); ?> | 
            <a href="<?php comments_link(); ?>"><?php
                echo get_comments_number();
                esc_html_e(' Comments', 'dakota-theme');
                ?></a>

        </p>

        <?php the_excerpt(); ?>

    <a class="btn btn-white" href="<?php the_permalink(); ?>"><?php esc_html_e('Read More', 'dakota-theme'); ?></a>

    </div><!-- blog-article-details -->	


</div><!-- blog-article -->