<?php
/**
 * Template part for displaying product section
 *
 * @package Weight Loss Center
 * @subpackage weight_loss_center
 */

?>
<?php $weight_loss_center_static_image = get_stylesheet_directory_uri() . '/assets/images/sliderimage.png'; 

if ( get_theme_mod( 'weight_loss_center_about_enable', true)) : ?>
  <section id="about">
    <div class="container py-5">
      <div class="row">
        <?php $weight_loss_center_about_page = array();
          $weight_loss_center_mod = absint( get_theme_mod( 'weight_loss_center_about_page' ));
          if ( 'page-none-selected' != $weight_loss_center_mod ) {
            $weight_loss_center_about_page[] = $weight_loss_center_mod;
          }
        if( !empty($weight_loss_center_about_page) ) :
          $weight_loss_center_args = array(
            'post_type' => 'page',
            'post__in' => $weight_loss_center_about_page,
            'orderby' => 'post__in'
          );
          $weight_loss_center_query = new WP_Query( $weight_loss_center_args );
          if ( $weight_loss_center_query->have_posts() ) :
            while ( $weight_loss_center_query->have_posts() ) : $weight_loss_center_query->the_post(); ?>
              <div class="col-lg-2 col-md-3 image-abt mb-3">
                <div class="about-block position-relative">
                    <div class="about-image1">
                        <div class="thumbnail position-relative">
                            <?php if ( has_post_thumbnail() ) : ?>
                                <?php the_post_thumbnail( 'full', array( 'alt' => esc_attr( get_the_title() ) ) ); ?>
                            <?php else : ?>
                                <img src="<?php echo esc_url( $weight_loss_center_static_image ); ?>" alt="<?php esc_attr_e( 'Placeholder', 'weight-loss-center' ); ?>" />
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
              </div>
              <div class="col-lg-4 col-md-3 abt-bg-img mb-3 ps-lg-3 ps-md-0 position-relative">
                <div class="about-banner">
                  <?php 
                    $weight_loss_center_image1 = get_theme_mod( 'weight_loss_center_abt_banner_image1', '' );
                    if ( $weight_loss_center_image1 ) : ?>
                        <img src="<?php echo esc_url( $weight_loss_center_image1 ); ?>" alt="<?php esc_attr_e( 'About Banner', 'weight-loss-center' ); ?>" />
                    <?php endif; ?>
                </div>
              </div>
              <div class="col-lg-6 col-md-6 about-box align-self-center">
                <?php if( get_theme_mod('weight_loss_center_about_short_heading') != ''){ ?>
                  <p class="abt-title"><?php echo esc_html(get_theme_mod('weight_loss_center_about_short_heading','')); ?></p>
                <?php }?>
                <h2 class="my-4"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
               <p class="pb-4"><?php echo wp_trim_words( get_the_content(),50 );?></p> 
                <div class="row pt-2">
                	<div class="more-btn col-lg-5 col-md-7 col-12 align-self-center">
                		<a href="<?php the_permalink(); ?>"><?php esc_html_e('LEARN MORE ABOUT US','weight-loss-center'); ?></a>
              		</div> 
              		<div class="advice-box col-lg-7 col-md-5 col-12 align-self-center">
              			<?php if( get_theme_mod('weight_loss_center_about_call_heading') != ''){ ?>
                  	<h3><?php echo esc_html(get_theme_mod('weight_loss_center_about_call_heading','')); ?></h3>
                		<?php }?>
                		<?php if( get_theme_mod('weight_loss_center_about_number') != ''){ ?>
                  	<p class="mb-0"><a href="tel:<?php echo esc_html( get_theme_mod('weight_loss_center_about_number','') ); ?>"><?php echo esc_html(get_theme_mod('weight_loss_center_about_number','')); ?></a></p>
                		<?php }?>
              		</div>
                </div> 
              </div>
            <?php endwhile; ?>
          <?php else : ?>
            <div class="no-postfound"></div>
          <?php endif;
        endif;
        wp_reset_postdata()?>
        <div class="clearfix"></div>
      </div>
    </div>
  </section>
<?php endif; ?>