<?php
/**
 * Template part for displaying services section
 *
 * @package Legal Law Consulting
 * @subpackage legal_law_consulting
 */

?>

<?php $legal_law_consulting_static_image = get_stylesheet_directory_uri() . '/assets/images/post-img1.png'; ?>
<?php if( get_theme_mod( 'legal_law_consulting_services_show_hide', true) != '') { ?>
<div id="services" class="py-5">
  <div class="container">
    <div class="row">
      <div class="col-lg-8 col-md-8 col-sm-8 align-self-center">
        <?php if( get_theme_mod('legal_law_consulting_services_title') != ''){ ?>
          <h3><i class="fas fa-balance-scale me-3 "></i><?php echo esc_html(get_theme_mod('legal_law_consulting_services_title','')); ?></h3>
        <?php }?>
        <?php if( get_theme_mod('legal_law_consulting_services_text') != ''){ ?>
          <p class="mb-0 subtitle"><?php echo esc_html(get_theme_mod('legal_law_consulting_services_text','')); ?></p>
        <?php }?>
      </div>
      <div class="col-lg-4 col-md-4 col-sm-4 align-self-center">
        <?php if( get_theme_mod('legal_law_consulting_services_btn_text') != '' || get_theme_mod('legal_law_consulting_services_btn_url') != ''){ ?>
          <div class="book-tkt-btn text-center text-md-end">
            <a class="register-btn" href="<?php echo esc_url(get_theme_mod('legal_law_consulting_services_btn_url','')); ?>"><?php echo esc_html(get_theme_mod('legal_law_consulting_services_btn_text','')); ?></a>
          </div>
        <?php }?>
      </div>
    </div>
    <div class="row mt-5">
      <?php 
        $legal_law_consulting_post_category = get_theme_mod('legal_law_consulting_services_section_category');
        if($legal_law_consulting_post_category){
          $legal_law_consulting_page_query = new WP_Query(array( 'category_name' => esc_html( $legal_law_consulting_post_category ,'legal-law-consulting')));?>
          <?php while( $legal_law_consulting_page_query->have_posts() ) : $legal_law_consulting_page_query->the_post(); ?>
            <div class="col-lg-4 col-md-6 col-sm-6">
              <div class="box mb-4">
                <?php if(has_post_thumbnail()) { ?><?php the_post_thumbnail(); ?><?php }else {echo ('<img src="'.$legal_law_consulting_static_image .'">'); } ?>
                <div class="box-content">
                  <div class="row">
                    <div class="col-lg-3 col-md-3 col-3">
                      <i class="fas fa-balance-scale me-3 "></i>
                    </div>
                    <div class="col-lg-9 col-md-9 col-9">
                      <h3 class="title text-start"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                    </div>
                  </div>
                  <p><?php echo wp_trim_words( get_the_content(),20 );?></p>
                  <a href="<?php the_permalink(); ?>"><?php esc_html_e('Read More','legal-law-consulting'); ?></a>
                </div>
              </div>
            </div>
          <?php endwhile;
          wp_reset_postdata();
        }
      ?>
    </div>
  </div>
</div>
<?php }?>