<?php
      
/**
 * Use for the show the testimonials at home page and in testimonial page with shortcode
 * @param int $pageId default is null the id of a post
 * @param boolean $isCustomizer default is false if set to true it mean the output is set for the home page
 * @param int $i default null
 * @param boolean $showStaticVals default is false
 * @return string
 * @author Luzuk <support@luzuk.com>
 * */
function testimonialShortCode($pageId = null, $isCustomizer = false, $i = null) {

    ob_start();

    $args = array('post_type' => 'our-testimonial');
    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }
    $colCls = '';
    // if($isCustomizer == true){
    $cols = get_theme_mod('test_npp_count', 5);
    $cols++;
    switch($cols){
        
            }
           $icons = array(1=>'heart', 2=>'star', 3=>'flash', 4=>'bell',5=>'heart', 6=>'star', 7=>'flash', 8=>'bell');     
    // }
    $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-team-thumb');
        $post = get_post();
 ?>
<!--            <div class="row"> -->
            <div class="<?php echo $colCls; ?> item innertest-item ">
                <div class="ts-area-single pd-0">
                    <div class="ts-inn">
                        <div class="ts-area-thumb">
                            <i class="fa fa-quote-left" aria-hidden="true"></i>
                            <img src="<?php echo (!empty($lz_fitness_image[0])) ? $lz_fitness_image[0] : get_template_directory_uri() . '/images/team-thumb.png' ?>" class="img-responsive" alt="<?php the_title(); ?>" />
                        </div>
                     
                        <div class="ts-area-content">
                            <p><?php
                                if (has_excerpt()) {
                                    echo get_the_excerpt();
                                } else {
                                    echo get_the_content();
                                }
                                ?> 
                            </p> 
                            <h6 class="ts-area-title"><?php the_title(); ?></h6>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                </div>
                <div class="clearfix"></div>
                 <script>
                        jQuery.noConflict();
                        $(function(){
                            function innertestitemHeight(){
                                var ht = 0;
                                $('#innerpage-box .innertest-item').each(function(i){
                                    var tHt = $(this).height();
                                    if(ht<tHt){
                                        ht=tHt;
                                    }
                                });
                                $('#innerpage-box .innertest-item').height(ht+'px');
                            }
                            innertestitemHeight();
                        });
                        $( window ).resize(function(){
                            innertestitemHeight();
                        });
                    </script>
            </div>
        <?php
    endwhile;
    $text = ob_get_contents();
    ob_clean();
endif;
wp_reset_postdata();
return $text;
}

/*services*/
function serviceShortCode($pageId = null, $isCustomizer = false, $i = null) {

    ob_start();

    $args = array('post_type' => 'our-services');
    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }
    $args['posts_per_page'] = -1;
    $colCls = '';
    // if($isCustomizer == true){
    $cols = get_theme_mod('service_npp_count',2);  
    $services_page_icon1 = get_theme_mod('services_page_icon1'.$i);

    ++$cols;
    switch ($cols) {
        case 1:
        $colCls = 'col-md-12 col-sm-12';
        break;
        case 2: 
        $colCls = 'col-md-6 col-sm-6';
        break;
        case 3:
        case 5:
        case 6:
        case 9:
        case 11:
        $colCls = 'col-md-4 col-sm-6';
        break;
        default: 
        $colCls = 'col-md-3 col-sm-6';
        break;
        }
    // }
        $text = '';
        $query = new WP_Query($args);
        if ($query->have_posts()):
            $postN = 0;

            while ($query->have_posts()) : $query->the_post();
                $luzuk_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'total-service-thumb');
                $post = get_post();

                 $servicesNum = get_post_meta($post->ID, 'servicesNum', false);
                    $services_Num = !empty($servicesNum[0]) ? $servicesNum[0] : '';
                ?>
                <div class="<?php echo $colCls;?> single-service-bx ">
                    <div class="single-service">
                        <div class="service-icon col-md-4 padding0">
                           <?php
                        if (has_post_thumbnail()) {
                            $image_url = $luzuk_image[0];
                        } else {
                            $image_url = get_template_directory_uri() . '/images/services.jpg';
                        }
                        ?>
                        <div class="sec-iocn"> 
                            <a href="<?php the_permalink(); ?>"><img class="img-responsive" src="<?php echo esc_url($image_url); ?>" alt="<?php the_title(); ?>" />
                                <div class="ovrlyT"></div>
                            </a>
                                <a href="<?php the_permalink(); ?>"><i class="<?php echo $services_page_icon1; ?>"></i></a> 
                                    
                            </div> 
                        </div>
                        <div class="service-title-box col-md-8">
                            <a href="<?php the_permalink(); ?>"> <h4 class="post-title inner-area-title"><?php the_title(); ?></h4></a>
                            <p class="post-text inner-area-text "> <?php
                                if(has_excerpt()){
                                  echo get_the_excerpt();
                                 }else{
                                  echo luzuk_excerpt( get_the_content() , 100 );
                                 } 
                                ?>
                            </p>
                            <?php if( get_theme_mod('services_button_display','show' ) == 'show') :
                            ?>
                            <?php
                                $ct_service_page_id = get_theme_mod('ct_service_page'); 
                                $servicesbutn_text = get_theme_mod('servicesbutn_text', 'READ MORE');
                                ?>

                            <div class="servicesbtn">
                                <a href="<?php the_permalink(); ?>"><?php echo $servicesbutn_text; ?></a>
                            </div>
                            <?php endif ?>
                        </div>
                    <div class="clearfix"></div>
                    </div>  

                        <script>
                        jQuery.noConflict();
                        $(function(){
                            function serviceinfoHeight(){
                                var ht = 0;
                                $('#innerpage-box .single-service-bx').each(function(i){
                                    var tHt = $(this).height();
                                    if(ht<tHt){
                                        ht=tHt;
                                    }
                                });
                                $('#innerpage-box .single-service-bx').height(ht+'px');
                            }
                            serviceinfoHeight();
                        });
                        $( window ).resize(function(){
                            serviceinfoHeight();
                        });
                    </script>
                </div>


                <?php
            endwhile;
            $text = ob_get_contents();
            ob_clean();
        endif;
        wp_reset_postdata();
        return $text;
    }

/**
 * Use for the show the gallery at home page and in testimonial page with shortcode
 * @param int $pageId default is null the id of a post
 * @param boolean $isCustomizer default is false if set to true it mean the output is set for the home page
 * @param int $i default null
 * @param boolean $showStaticVals default is false
 * @return string
 * @author Luzuk <support@luzuk.com>
 * */



