<?php
/**
 * The main template file
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package Better_Morning
 */

get_header();
?>

<!-- start body -->
<div class="bdy">

    <section class="inner_page_wrap blog-inner-wrap">
        <div class="container">
            <div class="row">
                <div class="col-md-10 col-md-offset-1 col-sm-8 col-sm-offset-2 text-center">
                    <h1 class="hd2"><?php the_field('subtitle') ?></h1>
                    <div class="spacer gap-20"></div>
                </div>
                <?php 
                if ( have_posts() ){
		    		while(have_posts()) {  the_post();
                ?>
                <div class="col-md-4 col-sm-6">
                  <div class="blog_sub_sec">
                    <div class="blog_img_sec">
                      <?php if(has_post_thumbnail()) {?>
                    	<img class="img-responsive" src="<?php echo the_post_thumbnail_url(); ?>" >
		              <?php } else { ?>
		                <img class="img-responsive" src="<?php echo IMAGE_PATH; ?>images/noImg.jpg">
		              <?php } ?>
                      <div class="date_sec">
                        <?php echo get_the_date('M'); ?> <span><?php echo get_the_date('d, Y'); ?></span>
                      </div>
                    </div>
                    <div class="blog_content_sec">
                      <h2><?php the_title(); ?></h2>
                      <p><?php echo wp_trim_words(get_the_content(),'15','...'); ?></p>
                      <a href="<?php echo esc_url(get_permalink());?>" class="btn1">Read More</a>
                    </div>
                  </div>
                </div>
                <?php } } ?>
            </div>
        </div>
    </section>


</div>
<!-- end body -->

<?php
get_footer();
