<?php

////new code
function featuredShortCode($pageId = null, $isCustomizer = false, $i = null) {
    ob_start();

    $args = array('post_type' => 'service');
    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }
    $args['posts_per_page'] = -1;
    $colCls = '';
    // if($isCustomizer == true){
    $cols = get_theme_mod('lz_fitness_featured_npp_count', 5);
    $cols++;
    switch($cols){
        case 1:
        $colCls = 'col-md-12 col-sm-12 col-xs-12';
        break;
        case 2:
        $colCls = 'col-md-6 col-sm-6 col-xs-12';
        break;
        case 3:
        case 5:
        case 6:
        $colCls = 'col-md-4 col-sm-6 col-xs-12';
        break;
        default:
        $colCls = 'col-md-3 col-sm-6 col-xs-12';
        break;
    }
    
    // }
    $text = '';
    $query = new WP_Query($args);
    if ($query->have_posts()):
        $postN = 0;

        while ($query->have_posts()) : $query->the_post();
            $lz_fitness_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'total-features-thumb');
            if ($isCustomizer === true) {
                $feature_designation = get_theme_mod('feature_designation' . $i);
            }
            $post = get_post();
            //designation
            $designation = get_post_meta($post->ID, 'designation', false);
            $feature_designation = !empty($designation[0]) ? $designation[0] : '';
            
            ?> 
            <div class="row">
                <div class="<?php echo $colCls; ?> about-box">
                    
                    <div class="about-post text-center">
                       
                           
                               <div class="about-icon">
                                <?php
                                if (has_post_thumbnail()) {
                                    $image_url = $lz_fitness_image[0];
                                } else {
                                    $image_url = get_template_directory_uri() . '/images/team-thumb.png';
                                }
                                ?>                  
                                <img src="<?php echo esc_url($image_url); ?>" alt="<?php the_title(); ?>" />
                                
                            </div>
                            <div class="details">
                                  <h5><a href="<?php the_permalink(); ?>"><?php echo wp_trim_words( get_the_title(), 4 ); ?></a></h5>  
                                    <div class="about-excerpt">
                                        <p>
                                        <?php

                                        if(has_excerpt()){
                                          echo get_the_excerpt();
                                      }else{
                                          echo lz_fitness_excerpt( get_the_content() , 90 );
                                      } 
                                      ?>
                                  </p>
                                    </div>
                            </div>

                         
              <div class="clearfix"></div>          
          </div>
      </div>
      <script>
    jQuery.noConflict();
    $(function(){
        function detailsHeight(){
            var ht = 0;
            $('.about-box .details').each(function(i){
                var tHt = $(this).height();
                if(ht<tHt){
                    ht=tHt;
                }
            });
            $('.about-box .details').height(ht+'px');
        }
        detailsHeight();
    });
    $( window ).resize(function(){
        detailsHeight();
    });
</script>
      <?php
  endwhile;
  $text = ob_get_contents();
  ob_clean();
endif;
wp_reset_postdata();
return $text;
}

add_shortcode('SERVICES', 'featuredShortCode');




    