<?php
/**
 * Template part for displaying latest news section
 *
 * @package Business Meetup Conference
 * @subpackage business_meetup_conference
 */

?>
<?php $business_meetup_conference_static_image = get_stylesheet_directory_uri() . '/assets/images/sliderimage.png'; ?>
<?php if( get_theme_mod( 'business_meetup_conference_latest_news_show_hide', true) != '') { ?>
<div id="latest_blog" class="mt-5">
  <div class="container">
    <?php if( get_theme_mod( 'business_meetup_conference_news_heading' ) != '' ) { ?>
      <h2 class="text-center mb-4"><?php echo esc_html( get_theme_mod( 'business_meetup_conference_news_heading','' ) ); ?></h2>
    <?php } ?>
    <div class="row">
      <?php
        $business_meetup_conference_post_category = get_theme_mod('business_meetup_conference_latest_news_section_category');
        if($business_meetup_conference_post_category){
          $business_meetup_conference_page_query = new WP_Query(array( 'category_name' => esc_html( $business_meetup_conference_post_category ,'business-meetup-conference')));?>
          <?php while( $business_meetup_conference_page_query->have_posts() ) : $business_meetup_conference_page_query->the_post(); ?>
            <div class="col-lg-3 col-md-6 col-sm-6">
              <div class="news-detail mb-4">
                <div class="news-img">
                  <?php if(has_post_thumbnail()) { ?><?php the_post_thumbnail(); ?><?php }else {echo ('<img src="'.$business_meetup_conference_static_image.'">'); } ?>
                </div>
                <div class="demo-box">
                  <?php if(get_theme_mod('business_meetup_conference_remove_date',true) != ''){ ?>
                      <span class="blog-date"><span><i class="fas fa-calendar m-2"></i></span><?php echo get_the_date( 'M j, Y' ); ?></span>
                  <?php }?>
                  <?php if(get_theme_mod('business_meetup_conference_remove_author',true) != ''){ ?>
                  <span class="author-detail float-right"><span><i class="fas fa-user m-2"></i></span><?php the_author();?></span>
                  <?php }?>
                  <h3 class="my-2"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                    <div class="box-btn">
                    <a href="<?php the_permalink(); ?>"><?php esc_html_e('Read More','business-meetup-conference'); ?><i class="fas fa-angle-double-right ms-2"></i></a>
                  </div>
                </div>
              </div>
            </div>
          <?php endwhile;
          wp_reset_postdata();
        }
      ?>
    </div>
  </div>
</div>
<?php }?>