<?php
/**
 * Template part for displaying coaching section
 *
 * @package Feminine Style Coach
 * @subpackage feminine_style_coach
 */

?>
<?php if( get_theme_mod( 'feminine_style_coach_coaching_section_show_hide', true ) != '') { ?>
<?php $feminine_style_coach_static_image = get_stylesheet_directory_uri() . '/assets/images/sliderimage.png'; ?>

<section id="coaching">
  <div class="container">
    <?php if( get_theme_mod('feminine_style_coach_coaching_tittle') != ''){ ?>
      <h2 class="text-center pb-3"><?php echo esc_html(get_theme_mod('feminine_style_coach_coaching_tittle','')); ?></h2>
    <?php }?>
    <div class="row">
      <?php
        $feminine_style_coach_post_category = get_theme_mod('feminine_style_coach_coaching_section_category');
        if($feminine_style_coach_post_category){
          $feminine_style_coach_page_query = new WP_Query(array( 'category_name' => esc_html( $feminine_style_coach_post_category ,'feminine-style-coach')));?>
          <?php while( $feminine_style_coach_page_query->have_posts() ) : $feminine_style_coach_page_query->the_post(); ?>
            <div class="col-lg-4 col-md-6 col-sm-6">
              <div class="news-detail mb-4">
                <div class="news-img">
                  <?php if(has_post_thumbnail()){ ?>
               <img class="my-4" src="<?php the_post_thumbnail_url('full'); ?>"/> <?php }else {echo ('<img src="'.esc_url( $feminine_style_coach_static_image  ) .'">'); } ?>
                </div>
                <div class="demo-box">
                  <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                  <p><?php echo esc_html( wp_trim_words( get_the_content(),15 ) );?></p> 
                </div>
              </div>
            </div>
          <?php endwhile;
          wp_reset_postdata();
        }
      ?>
    </div>
  </div>
</section>
<?php } ?>
