<?php
/**
 * Author: Ranjan deb
 *
 */
if (!function_exists('EAH_setup')):
    function EAH_setup() {

        add_theme_support('title-tag');
        add_theme_support('post-thumbnails');
        set_post_thumbnail_size(825, 510, true);
        register_nav_menus(array('primary' => __('Header Menu', 'EAH'),'top_menu' => __('Top Menu', 'EAH'),'sidebar_service_menu' => __('Sidebar Service Menu', 'EAH'),'service_menu' => __('Our Service Menu', 'EAH')));
        add_theme_support('custom-logo', array('height' => 300, 'width' => 300, 'flex-height' => true,));
        add_theme_support('wc-product-gallery-zoom');
        add_theme_support('wc-product-gallery-lightbox');
        add_theme_support('wc-product-gallery-slider');
        add_theme_support('post-thumbnails');
        add_theme_support('title-tag');
        add_theme_support('woocommerce');
        add_theme_support(
            'post-formats',
            array(
                'link',
                'aside',
                'gallery',
                'image',
                'quote',
                'status',
                'video',
                'audio',
                'chat',
            )
        );

        add_theme_support(
            'html5',
            array(
                'comment-form',
                'comment-list',
                'gallery',
                'caption',
                'style',
                'script',
                'navigation-widgets',
            )
        );

        $logo_width  = 300;
        $logo_height = 300;
        add_theme_support(
            'custom-logo',
            array(
                'height'               => $logo_height,
                'width'                => $logo_width,
                'flex-width'           => true,
                'flex-height'          => true,
                'unlink-homepage-logo' => true,
            )
        );
        // Add theme support for selective refresh for widgets.
        add_theme_support( 'customize-selective-refresh-widgets' );
        // Add support for Block Styles.
        add_theme_support( 'wp-block-styles' );
        // Add support for full and wide align images.
        add_theme_support( 'align-wide' );
    }
endif;
add_action('after_setup_theme', 'EAH_setup');


function EAH_theme_css_assets() {
    wp_enqueue_style('main', get_stylesheet_uri());
    wp_enqueue_style( 'favicon', get_template_directory_uri() . '/assets/img/favicon.png' );
    wp_enqueue_style( 'appletouchicon', get_template_directory_uri() . '/assets/img/apple-touch-icon.png' );
    wp_enqueue_style( 'fontsgoogleapis', 'https://fonts.googleapis.com/css?family=Open+Sans:300,400,400i,600,700|Raleway:300,400,400i,500,500i,700,800,900' );
    wp_enqueue_style( 'animatemin', get_template_directory_uri() . '/assets/vendor/animate.css/animate.min.css' );
    wp_enqueue_style( 'bootstrapmincss', get_template_directory_uri() . '/assets/vendor/bootstrap/css/bootstrap.min.css' );
    wp_enqueue_style( 'bootstrapiconscss', get_template_directory_uri() . '/assets/vendor/bootstrap-icons/bootstrap-icons.css' );
    wp_enqueue_style( 'boxiconsmincss', get_template_directory_uri() . '/assets/vendor/boxicons/css/boxicons.min.css' );
    wp_enqueue_style( 'glightboxmincss', get_template_directory_uri() . '/aassets/vendor/glightbox/css/glightbox.min.css' );
    wp_enqueue_style( 'responsivecss', get_template_directory_uri() . '/assets/css/responsive.css' );
    wp_enqueue_style( 'stylecss', get_template_directory_uri() . '/assets/css/style.css' );
}
//add_action('wp_enqueue_scripts', 'EAH_theme_css_assets');


function EAH_theme_js_assets() {
   wp_enqueue_script('bootstrapbundleminjs', get_stylesheet_directory_uri().'/assets/vendor/bootstrap/js/bootstrap.bundle.min.js',array(), false, true);
   wp_enqueue_script('glightboxminjs', get_stylesheet_directory_uri().'/assets/vendor/glightbox/js/glightbox.min.js',array(), false, true);
   wp_enqueue_script('isotopepkgdminjs', get_stylesheet_directory_uri().'/assets/vendor/isotope-layout/isotope.pkgd.min.js',array(), false, true);
   wp_enqueue_script('swiperbundleminjs', get_stylesheet_directory_uri().'/assets/vendor/swiper/swiper-bundle.min.js',array(), false, true);
   wp_enqueue_script('swiperbundleminjs', get_stylesheet_directory_uri().'/assets/vendor/swiper/swiper-bundle.min.js',array(), false, true);
   wp_enqueue_script('mainjs', get_stylesheet_directory_uri().'/assets/js/main.js',array(), false, true);

}
//add_action('wp_enqueue_scripts', 'EAH_theme_js_assets');

/**
 * Register widget area.
 *
 */
function EAH_widgets_init() {
    register_sidebar(array('name' => __('Sidebar 1', 'EAH'), 'id' => 'EAH-sidebar-1', 'description' => __('Add widgets here to appear in home page newsletter section.', 'EAH'), 'before_widget' => '', 'after_widget' => '',));

    register_sidebar(array('name' => __('Sidebar 2', 'EAH'), 'id' => 'EAH-sidebar-2', 'description' => __('Add widgets here to appear in shop sidebar.', 'EAH'), 'before_widget' => '', 'after_widget' => '',));
}
add_action('widgets_init', 'EAH_widgets_init');

require_once ('inc-EAH/navwalker-functions.php');
require_once ('inc-EAH/bs4navwalker.php');
require_once ('inc-EAH/wordpress-extrafeatures-fuctions.php');
//require_once ('custom-posts/custom-faq.php');
//require_once ('custom-posts/custom-testimonial.php');
//require_once ('custom-posts/custom-team.php');
require_once ('custom-posts/custom-service.php');
//require_once ('custom-posts/custom-condition.php');

/**
     * For Header Slider
     * =================
     *
*/ 
add_shortcode( 'EAH_slider', 'EAH_slider_list' );
function EAH_slider_list($atts = array(), $content = '', $post_id = '' ) {
    //function sp_cpt_shortcode( $atts, $content = null ) {
    extract(shortcode_atts(array(
        "limit" => ''
    ), $atts));
    // Define limit
    if( $limit ) { 
        $posts_per_page = $limit; 
    } else {
        $posts_per_page = '-1';
    }
    $atts = shortcode_atts( array(), $atts );
    $the_query = new WP_Query( array(
        'post_type' => 'our_slider',
        'post_status' => 'publish',
        'posts_per_page' => $posts_per_page,
        'order' => 'ASC'
    ) );
ob_start();
    $i = 0;
    while ( $the_query->have_posts() ) :$the_query->the_post();
    $active = ( $i == 0 )?'active':'' ;
    $featured_img_url = get_the_post_thumbnail_url(get_the_ID(),'full');
    ?>

    <div class="carousel-item <?php echo $active;?>" style="background-image:url(<?php echo $featured_img_url;?>)">
         <div class="container">
            <div class="slider-content text-center">
               <div class="col-md-12">
<!--                   <div class="flag"><img src="<?php //echo get_stylesheet_directory_uri();?>/images/usaflag.png"></div>  -->
                  <p><?php the_field('short_title'); ?></p>
                  <h2 class="slide-title-classic animated3"><?php the_field('long_title'); ?></h2>
                  <p class="animated3">
                     <a href="<?php the_field('button_link'); ?>" class="slider btn btn-primary">Find Out if You're Eligible</a>
<!--                      <a class="sliderbtn2 btn-border" id="myBtn"><img src="<?php //echo get_stylesheet_directory_uri();?>/images/sliderbtn2.png">Watch Our Story</a> -->
                  </p>
               </div>
               <!-- Col end -->
            </div>
            <!-- Slider content end -->
         </div>
         <!--Container end -->
      </div>
      
      <!-- The Modal -->
    <div id="myModal" class="modal">
      <!-- Modal content -->
      <div class="modal-content">
        
                <video width="100%" controls>
                 <source src="<?php the_field('watch_our_story_video',7); ?>" type="video/mp4">
                 <source src="movie.ogg" type="video/ogg">
               </video>
               <span class="close">&times;</span>
               <p class="text-center"><a href="#videosec" class="close">Go To Details</a></p>
               <p class="text-center">English, Spanish, Polish, Arabic, Hindi, Japanese, Punjabi, Gujarati, Korean, Russian, Tagalog, Bengali, Mandarin, Cantonese, French, Farsi</p>
               
      </div>
    
    </div>
<?php
    $i++;
    endwhile;
    wp_reset_postdata();
        return ''.ob_get_clean().'';
}
add_shortcode( 'SI_slider_indicator', 'EAH_slider_indicator_list' );

@ini_set( 'upload_max_size' , '6400M' );
@ini_set( 'post_max_size', '6400M');
@ini_set( 'max_execution_time', '30000' );

/**
     * For all categories
     * =================
     *
*/  

add_shortcode( 'EAH_categories', 'EAH_categories_list' );
function EAH_categories_list($atts = array(), $content = '', $post_id = '' ) {

            global $product;
            global $woocommerce;

            $taxonomy     = 'product_cat';
            $orderby      = 'name';  
            $show_count   = 0;      // 1 for yes, 0 for no
            $pad_counts   = 0;      // 1 for yes, 0 for no
            $hierarchical = 1;      // 1 for yes, 0 for no  
            $empty        = 0;

              $args = array(
                     'taxonomy'     => $taxonomy,
                     'orderby'      => $orderby,
                     'show_count'   => $show_count,
                     'pad_counts'   => $pad_counts,
                     'hierarchical' => $hierarchical,
                     'hide_empty'   => $empty
              );
               $all_categories = get_categories( $args );

                 foreach ($all_categories as $cat) {
                    if($cat->category_parent == 0) {
                        $category_id = $cat->term_id;

                           // get the thumbnail id using the queried category term_id
                            $thumbnail_id = get_term_meta( $cat->term_id, 'thumbnail_id', true ); 
                            // get the image URL
                            $image = wp_get_attachment_url( $thumbnail_id );
             ?>        
            <div class="col-lg-12 col-md-12 col-12">
              <div class="image_decor position-relative w-auto">
                <img src="<?php echo $image; ?>" class="img-fluid rounded-end rounded-start d-block w-100" alt="">
                <div class="cat-overlay bg-black bg-opacity-50 rounded-end rounded-start">
                  <h2><?=$cat->name?></h2>
                </div>
              </div>
            </div>

             <?php
                    }   
                }
                wp_reset_postdata();
                

}

 if ( has_nav_menu('product-linting-sidebar') ) {
function add_link_atts($atts) {
  $atts['class'] = "link-dark d-inline-flex text-decoration-none rounded";
  return $atts;
}

add_filter( 'nav_menu_link_attributes', 'add_link_atts');
}


/*echo '<br /><a href="'. get_term_link($cat->slug, 'product_cat') .'">'. $cat->name .'</a>';*/
/*function add_link_atts($atts)
{
    $atts["class"] = "nav-link dropdown-toggle";
    return $atts;
}*/
//add_filter("nav_menu_link_attributes", "add_link_atts");

/**
* For MAP Link
* =========
*
*/
add_shortcode( 'EAH_MAP', 'EAH_MAP_list' );

function EAH_MAP_list($atts = array(), $content = '', $post_id = '' ) {
        
?>

<iframe src="<?php echo html_entity_decode( get_option( 'option_10' ) );?>" width="100%" height="400" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
<?php
wp_reset_postdata();
}

/**
* For Home Video
* =========
*
*/
add_shortcode( 'EAH_HOME_VIDEO', 'EAH_HOME_VIDEO_list' );

function EAH_HOME_VIDEO_list($atts = array(), $content = '', $post_id = '' ) {
    if(have_rows('fifth_section_videos')):
        $i=0; while(have_rows('fifth_section_videos')):
             the_row();       
?>
        <figure class="item videobox">
             <div class="videobox">
                <!--<img class="videopic" src="<?php echo get_stylesheet_directory_uri();?>/images/Rectangle10.jpg" alt=""/>-->
                <iframe width="100%" height="270px" src="<?php the_sub_field('video_link'); ?>" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
             </div>
             <div class="video_con">
                <h4><?php the_sub_field('video_title'); ?></h4>
                <p><img src="<?php the_sub_field('country_flag'); ?>"></p>
             </div>
        </figure>
<?php
        $i++; endwhile;wp_reset_postdata();
    endif;


}

/**
* For Service Video
* =========
*
*/
add_shortcode( 'EAH_VIDEO', 'EAH_VIDEO_list' );

function EAH_VIDEO_list($atts = array(), $content = '', $post_id = '' ) {
        
?>
<section id="testimonials" class="testimonialarea">
   <div class="container">
      <!-- Title row end -->
      <div class="row">
         <div id="video-carousel" class="col-sm-12 owl-carousel owl-theme text-center">
           
         </div>
         <!--/ Owl carousel end -->
      </div>
      <!--/ Content row end -->
   </div>
   <!--/ Container end -->
</section>
<?php
}


/**
* For HOW IT WORKS
* =========
*
*/
add_shortcode( 'EAH_HOW_IT_WORKS', 'EAH_HOW_IT_WORKS_list' );

function EAH_HOW_IT_WORKS_list($atts = array(), $content = '', $post_id = '' ) {
        
?>
            <?php
                $args = array ( 
                    'post_type'      => 'my_how_it_works',
                    'post_status'    => 'publish',  
                    'orderby' => 'publish_date',
                    'order' => 'DESC',  
                    'posts_per_page' => -1
                );
                $query = new WP_Query($args);
                $post_count = $query->post_count;
                if ( $query->have_posts() ){
                $i = 1;
                  while ( $query->have_posts() ){
                    $query->the_post();
                    $img_url = get_the_post_thumbnail_url( get_the_ID(),'full');
                    $post = get_post(get_the_ID());
           ?>

              <div class="col-lg-4">
                  <div
                    class="process-item mb-65 wow fadeInUp"
                    data-wow-delay=".2s"
                  >
                    <div class="text">
                      <span class="step"><?php echo $i;?></span>
                      <h4><?php echo get_the_title();?></h4>
                    </div>
                  </div>
                </div>

           <?php
               $i++;
              }
            }wp_reset_postdata();
            ?>
<?php
}


/**
* For Team Page
* =========
*
*/
add_shortcode( 'EAH_OUR_TEAM', 'EAH_OUR_TEAM_list' );

function EAH_OUR_TEAM_list($atts = array(), $content = '', $post_id = '' ) {
        
?>
          <?php
                $args = array ( 
                    'post_type'      => 'team',
                    'post_status'    => 'publish',  
                    'orderby' => 'publish_date',
                    'order' => 'DESC',  
                    'posts_per_page' => -1
                );
                $query = new WP_Query($args);
                $post_count = $query->post_count;
                if ( $query->have_posts() ){
                $i = 1;
                  while ( $query->have_posts() ){
                    $query->the_post();
                    $img_url = get_the_post_thumbnail_url( get_the_ID(),'full');
                    $post = get_post(get_the_ID());
           ?>
               <div class="col-lg-4 col-md-6 col-sm-6 col-12">
                  <div class="team_con">
                     <div class="box">
                        <img src="<?php echo $img_url;?>">
                     </div>
                     <h3 class="title"><?php echo get_the_title();?></h3>
                     <h4>(<?php echo get_the_excerpt();?>)</h4>
                     <a href="<?php the_permalink();?>" class="readmore">Read More</a>
                  </div>
               </div>
            <?php
               $i++;
              }
            }wp_reset_postdata();
            ?>
<?php
}

/**
* For Testimonial Page
* =========
*
*/
add_shortcode( 'EAH_TESTIMONIALS', 'EAH_TESTIMONIALS_list' );

function EAH_TESTIMONIALS_list($atts = array(), $content = '', $post_id = '' ) {
        
?>
          <?php
                $args = array ( 
                    'post_type'      => 'testimonial',
                    'post_status'    => 'publish',  
                    'orderby' => 'publish_date',
                    'order' => 'DESC',  
                    'posts_per_page' => -1
                );
                $query = new WP_Query($args);
                $post_count = $query->post_count;
                if ( $query->have_posts() ){
                $i = 1;
                  while ( $query->have_posts() ){
                    $query->the_post();
                    $img_url = get_the_post_thumbnail_url( get_the_ID(),'full');
                    $post = get_post(get_the_ID());
           ?>
           
                <div class="col-lg-6 col-md-12 col-sm-12 col-12">
        			<div class="reviewcon">
            			<h3><?php echo get_the_title();?></h3> 
            			<div class="star d-flex">
            			<i class="fas fa-star"></i>
            			<i class="fas fa-star"></i>
            			<i class="fas fa-star"></i>
            			<i class="fas fa-star"></i>
            			<i class="fas fa-star"></i>	
            			</div>  
            			<?php echo get_the_content();?>
        			</div>
			    </div>
           <?php
               $i++;
              }
            }wp_reset_postdata();
            ?>
<?php
}



/**
* For Contact US Form
* =========
*
*/
add_shortcode( 'EAH_CONTACT_US_FORM', 'EAH_CONTACT_US_FORM_list' );

function EAH_CONTACT_US_FORM_list() {
        
?>
<section class="contact-area contact-area-v3 pt-130 pb-130">
   <div class="container-1350">
      <div class="contact-wrapper light-gray-bg pt-80 pb-80 wow fadeInUp">
         <div class="container">
            <div class="row justify-content-center">
               <div class="col-lg-7">
                  <div class="section-title text-center mb-55">
                     <span class="sub-title st-one"><?php the_field('second_section_short_title',13); ?></span>
                     <h2><?php the_field('second_section_big_title',13); ?></h2>
                  </div>
               </div>
            </div>
            <div class="row">
               <div class="col-lg-12">
                  <div class="contact-form">
                     <?php echo do_shortcode('[contact-form-7 id="42" title="Contact Form"]');?>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </div>
</section>
<?php
wp_reset_postdata();
}


/**
* For Home Blog
* =========
*
*/
add_shortcode( 'EAH_HOME_BLOG', 'EAH_HOME_BLOG_list' );

function EAH_HOME_BLOG_list($atts = array(), $content = '', $post_id = '' ) {
        
?>
          <?php
                $args = array ( 
                    'post_type'      => 'post',
                    'post_status'    => 'publish',  
                    'orderby' => 'publish_date',
                    'order' => 'DESC',  
                    'posts_per_page' => 3
                );
                $query = new WP_Query($args);
                

                $post_count = $query->post_count;
                if ( $query->have_posts() ){
                $i = 1;
                  while ( $query->have_posts() ){
                    $query->the_post();
                    $img_url = get_the_post_thumbnail_url( get_the_ID(),'full');
                    $post = get_post(get_the_ID());
                    $the_cat = get_the_category(get_the_ID());
                    $cat_name = $the_cat[0]->name;
              ?>
				<div class="single-blog-style1 wow fadeInLeft" data-wow-delay="100ms" data-wow-duration="1500ms">
                        <div class="img-holder">
                            <div class="date-box"><h5><?php echo get_the_date( 'D M j' );?></h5></div>
                            <div class="inner">
                                <img src="<?php echo $img_url; ?>" alt="Awesome Image">
                            </div>
                        </div> 
                        <div class="text-holder">
<!--                             <ul class="meta-info">
                                <li><span class="icon-user"></span><a href="#">By Admin</a></li>
                                <li><span class="icon-tag"></span><a href="#">Pet, Care, Medicine</a></li>
                            </ul> -->
                            <h3 class="blog-title"><a href="blog-single.html"><?php echo get_the_title();?><span class="round-box zoominout"></span></a></h3>
                        </div> 
                    </div>

            
              <?php
                 $i++;
                }
              }wp_reset_postdata();
              ?>
<?php
}

/**
 * For Blog 
 * =========
 *
 */
     
add_shortcode( 'EAH_blog', 'EAH_blog_list' );

function EAH_blog_list($atts = array(), $content = '', $post_id = '' ) {
    //function sp_cpt_shortcode( $atts, $content = null ) {
    extract(shortcode_atts(array(
        "limit" => ''
    ), $atts));
    
    // Define limit
    if( $limit ) { 
        $posts_per_page = $limit; 
    } else {
        $posts_per_page = '-1';
    }
    $atts = shortcode_atts( array(), $atts );
    global $wpdb;
    global $post;

    $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
    $args = array ( 
    'post_type'      => array( 'post' ), 
    'orderby'        => 'post_date', 
    'order'          => 'DESC',
    'posts_per_page' => -1,
    'paged' => $paged
    ); 

    $query = new WP_Query($args);
    $post_count = $query->post_count;
    if ( $query->have_posts() ){
    $i = 1;
      while ( $query->have_posts() ){ $query->the_post();
            $img_url = get_the_post_thumbnail_url( get_the_ID(),'full');
            $post = get_post(get_the_ID());
            //$the_cat = get_the_category(get_the_ID());
            //$cat_name = $the_cat[0]->name;
    ?>
    <div class="col-xl-4 col-lg-6 col-md-6">
                <div class="single-blog-style1 wow fadeInLeft" data-wow-delay="100ms" data-wow-duration="1500ms">
                    <div class="img-holder">
                        <div class="date-box"><h5><?php echo get_the_date( 'D M j' );?></h5></div>
                        <div class="inner">
                            <img src="<?php echo $img_url; ?>" alt="Awesome Image">
                        </div>
                    </div> 
                    <div class="text-holder">
                        <!--<ul class="meta-info">-->
                        <!--    <li><span class="icon-user"></span><a href="#">By Admin</a></li>-->
                        <!--    <li><span class="icon-tag"></span><a href="#">Pet, Care, Medicine</a></li>-->
                        <!--</ul>-->
                        <h3 class="blog-title"><a href="<?php the_permalink();?>"><?php echo get_the_title();?><span class="round-box zoominout"></span></a></h3>
                    </div> 
                </div> 
            </div>
           
<?php
    $i++;
    }
    ?>
    <div class="col-lg-12"><nav class="pagination">
     <?php
     $big = 999999999;
     echo paginate_links( array(
          'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
          'format' => '?paged=%#%',
          'current' => max( 1, get_query_var('paged') ),
          'total' => $query->max_num_pages,
          'prev_text' => '&laquo;',
          'next_text' => '&raquo;'
     ) );
?>
</nav></div>
    <?php
        }else{
        echo '<h2>No posts are found</h2>';
        }
        wp_reset_postdata();
    }


/**
* For LOwer Section Page
* =========
*
*/
add_shortcode( 'EAH_LOWER_SECTION', 'EAH_LOWER_SECTION_list' );

function EAH_LOWER_SECTION_list() {
       
?>
   <div class="footer-top pt-75 pb-40">
      <div class="row align-items-center">
        <div class="col-md-6">
          <div class="footer-logo mb-40 wow fadeInLeft">
            <img src="<?php the_field('footer_logo',5); ?>" alt="Brand Logo" />
          </div>
        </div>
        <div class="col-md-6">
          <div class="text-wrapper mb-40 wow fadeInRight">
            <?php the_field('footer_right_content',5); ?>
          </div>
        </div>
      </div>
    </div>
<?php
}

/**
* For LOWER SERVICES
* =========
*
*/
add_shortcode( 'EAH_LOWER_SERVICES', 'EAH_LOWER_SERVICES_list' );

function EAH_LOWER_SERVICES_list($atts = array(), $content = '', $post_id = '' ) {
        
?>
    <div class="moreservice" id="moreservice">
       <div class="container">
          <div class="row">
             <div class="col-lg-12 col-md-12 col-sm-12 col-12 text-center">
                <div class="section-heading">
                   <h2>Our More Services</h2>
                </div>
             </div>
             <div class="col-lg-12 col-md-12 col-sm-12 col-12">
                <div class="owl-carousel more-service">

          <?php
                $args = array ( 
                    'post_type'      => 'service',
                    'post_status'    => 'publish',  
                    'orderby' => 'publish_date',
                    'order' => 'DESC',  
                    'posts_per_page' => -1
                );
                $query = new WP_Query($args);
                

                $post_count = $query->post_count;
                if ( $query->have_posts() ){
                $i = 1;
                  while ( $query->have_posts() ){
                    $query->the_post();
                    $img_url = get_the_post_thumbnail_url( get_the_ID(),'full');
                    $post = get_post(get_the_ID());
              ?>
                <div class="item">
                  <div class="service-item hvr-float-shadow">
                     <img src="<?php the_field('small_image'); ?>" alt="">
                     <div class="down-content">
                        <h4><?php echo get_the_title();?></h4>
                        <p><?php echo get_the_excerpt();?></p>
                        <a href="<?php the_permalink();?>" class="filled-button">Read More</a>
                     </div>
                  </div>
               </div>
              <?php
                 $i++;
                }
              }wp_reset_postdata();
              ?>
              </div>
            </div>
        </div>
       </div>
    </div>      
<?php
}

/**
* For Home SERVICES
* =========
*
*/
add_shortcode( 'EAH_HOME_SERVICES', 'EAH_HOME_SERVICES_list' );

function EAH_HOME_SERVICES_list($atts = array(), $content = '', $post_id = '' ) {
        
?>
          <?php
                $args = array ( 
                    'post_type'      => 'service',
                    'post_status'    => 'publish',  
                    'orderby' => 'publish_date',
                    'order' => 'DESC',  
                    'posts_per_page' => 3
                );
                $query = new WP_Query($args);
                

                $post_count = $query->post_count;
                if ( $query->have_posts() ){
                $i = 1;
                  while ( $query->have_posts() ){
                    $query->the_post();
                    $img_url = get_the_post_thumbnail_url( get_the_ID(),'full');
                    $post = get_post(get_the_ID());
              ?>
                <div class="col-lg-3 col-md-6 col-12 col-12">
                    <div class="single-news">
                      <div class="news-head">
                        <img src="<?php the_field('small_image'); ?>" alt="#">
                      </div>
                      <div class="news-body">
                        <div class="news-content">
                          <h2><?php echo get_the_title();?></h2>
                          <p class="text"><?php echo get_the_excerpt();?></p>
                          <a href="<?php the_permalink();?>" class="text-link">Find out More <i class="fas fa-angle-right"></i>
                          </a>
                        </div>
                      </div>
                    </div>
                  </div>
              <?php
                 $i++;
                }
              }wp_reset_postdata();
              ?>
<?php
}
