<?php
/**
 * Template part for displaying direction section
 *
 * @package Medical Medicare
 * @subpackage medical_medicare
 */
?>
<?php $medical_medicare_static_image = get_stylesheet_directory_uri() . '/assets/images/sliderimage.png'; ?>
<?php if( get_theme_mod( 'medical_medicare_directions_section_show_hide', true) != '') { ?>
<section id="featured-car" class="py-5">
  <div class="container">
    <?php if( get_theme_mod('medical_medicare_services_section_tittle') != ''){ ?>
      <h2 class="text-center mb-4"><?php echo esc_html(get_theme_mod('medical_medicare_services_section_tittle','')); ?></h2>
    <?php }?>
    <div class="row">
      <?php
        $medical_medicare_post_category = get_theme_mod('medical_medicare_services_section_category');
        if($medical_medicare_post_category){
          $medical_medicare_page_query = new WP_Query(array( 'category_name' => esc_html( $medical_medicare_post_category ,'medical-medicare')));?>
          <?php while( $medical_medicare_page_query->have_posts() ) : $medical_medicare_page_query->the_post(); ?>
            <div class="col-lg-3 col-md-4 col-sm-4">
              <div class="cat-inner-box mb-3">
                <?php if(has_post_thumbnail()) { ?>
                  <?php the_post_thumbnail(); ?>
                <?php }else {echo ('<img src="'.$medical_medicare_static_image .'">'); } ?>
                <div class="read-more-btn">
                  <a href="<?php the_permalink(); ?>"><?php esc_html_e('Read More','medical-medicare'); ?></a>
                </div>
              </div>
              <div class="car-inner-content">
                <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                <p><?php echo wp_trim_words( get_the_content(),15 );?></p>
              </div>
            </div>
          <?php endwhile;
          wp_reset_postdata();
        }
      ?>
    </div>
  </div>
</section> 
<?php }?>