<?php 

//faq
//team 
function teamShortCode($pageId = null, $isCustomizer = false, $i = null) { 

    ob_start();

    $args = array('post_type' => 'our-team');
    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }
    $args['posts_per_page'] = -1;
    $colCls = '';
    // if($isCustomizer == true){
    $cols = get_theme_mod('lz_fitness_team_npp_count', 3);
    $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;
        case 4:
        case 7:
        case 8:
        $colCls = 'col-md-3 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-team-thumb');
            if ($isCustomizer === true) {
                $lz_fitness_team_designation = get_theme_mod('lz_fitness_team_designation' . $i);
                $lz_fitness_team_facebook = get_theme_mod('lz_fitness_team_facebook' . $i);
                $lz_fitness_team_twitter = get_theme_mod('lz_fitness_team_twitter' . $i);
                $lz_fitness_team_linkedin = get_theme_mod('lz_fitness_team_linkedin' . $i);
                $lz_fitness_team_instagram = get_theme_mod('lz_fitness_team_instagram' . $i);
                //$lz_fitness_team_googleplus = get_theme_mod('lz_fitness_team_googleplus' . $i);
            } else {
                $lz_fitness_team_facebook = '';
                $lz_fitness_team_twitter = '';
                $lz_fitness_team_linkedin = '';
                $lz_fitness_team_instagram = '';
                //$lz_fitness_team_googleplus = '';
            }

            $post = get_post();
            //Social media urls
            $teamFacebook = get_post_meta($post->ID, 'teamFacebook', false);
            $lz_fitness_team_facebook = !empty($teamFacebook[0]) ? $teamFacebook[0] : '';
            $teamTwitter = get_post_meta($post->ID, 'teamTwitter', false);
            $lz_fitness_team_twitter = !empty($teamTwitter[0]) ? $teamTwitter[0] : '';
            // $teamGPlus = get_post_meta($post->ID, 'teamGPlus', false);
            // $lz_fitness_team_google_plus = !empty($teamGPlus[0]) ? $teamGPlus[0] : '';

            $teamInstagram = get_post_meta($post->ID, 'teamInstagram', false);
            $lz_fitness_team_instagram = !empty($teamInstagram[0]) ? $teamInstagram[0] : '';

            $teamlinkedIn = get_post_meta($post->ID, 'teamlinkedIn', false);
            $lz_fitness_team_linkedin = !empty($teamlinkedIn[0]) ? $teamlinkedIn[0] : '';

            $teamgoogleplus = get_post_meta($post->ID, 'teamgoogleplus', false);
           // $lz_fitness_team_googleplus = !empty($teamgoogleplus[0]) ? $teamgoogleplus[0] : '';

            //designation
            $designation = get_post_meta($post->ID, 'designation', false);
            $lz_fitness_team_designation = !empty($designation[0]) ? $designation[0] : '';

            
            ?>
            <div class="row">
                <div class="<?php echo $colCls; ?>">
                    <div class="our-team wow zoomIn padding5" data-wow-duration="2s">
                        <div class="pic"> 
                            <?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 class="team-content"></div>
                        </div>
                        <h3 class="team-title"><?php the_title(); ?></h3>
                        <p class="post"><?php echo ($lz_fitness_team_designation); ?></p>

                        <ul class="team-sociallink">
                            <?php if ($lz_fitness_team_facebook || $lz_fitness_team_twitter || $lz_fitness_team_instagram || $lz_fitness_team_linkedin ) { ?>

                                <?php if ($lz_fitness_team_facebook) { ?>
                                 <li> <a target="_blank" href="<?php echo esc_url($lz_fitness_team_facebook) ?>" class="teamsocial green"><i class="fa fa-facebook"></i></a></li>
                             <?php } ?>
                             <?php if ($lz_fitness_team_twitter) { ?>
                                 <li> <a target="_blank" href="<?php echo esc_url($lz_fitness_team_twitter) ?>" class="teamsocial green"><i class="fa fa-twitter"></i></a></li>
                             <?php } ?>
                             
                          <?php if ($lz_fitness_team_linkedin) { ?>
                              <li>  <a target="_blank" href="<?php echo esc_url($lz_fitness_team_linkedin) ?>" class="teamsocial green"><i class="fa fa-linkedin"></i></a> </li>
                          <?php } ?>

                          <?php if ($lz_fitness_team_instagram) { ?>
                           <li>   <a target="_blank" href="<?php echo esc_url($lz_fitness_team_instagram) ?>" class="teamsocial green"><i class="fa fa-instagram"></i></a> </li>
                       <?php } ?>
                   <?php } ?>            
               </ul>
           </div>  

           <!-- for innerpages -->
<script>
    jQuery.noConflict();
    $(function(){
        function ourteamHeight(){
            var ht = 0;
            $('#innerpage-box div#content-box .our-team').each(function(i){
                var tHt = $(this).height();
                if(ht<tHt){
                    ht=tHt;
                }
            });
            $('#innerpage-box div#content-box .our-team').height(ht+'px');
        }
        ourteamHeight();
    });
    $( window ).resize(function(){
        ourteamHeight();
    });
</script>
<!-- for innerpages -->


</div>
<?php
endwhile;
$text = ob_get_contents();
ob_clean();
endif;
wp_reset_postdata();
return $text;
}
/**
 * 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>
 * */


/*services*/
function ctserviceShortCode($pageId = null, $isCustomizer = false, $i = null) {
    ob_start();
    $args = array('post_type' => 'our-service'); 
    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }
    $args['posts_per_page'] = -1;
    $colCls = '';
    // if($isCustomizer == true){
    $cols = get_theme_mod('lz_fitness_ct_service_npp_count',2);  
    $lz_fitness_ct_service_icon1 = get_theme_mod('lz_fitness_ct_service_icon1'.$i);
    ++$cols;
    switch ($cols) {
       case 1:
       $colCls = 'col-md-12 col-sm-12';
       break;
       case 2:
       $colCls = 'col-md-4 col-sm-6 col-xs-12';
       break;
       case 3:
       case 5:
       case 6: 
       case 9: 
       $colCls = 'col-md-4 col-sm-6 col-xs-12';
       break;
       case 4: 
       case 7:
       case 8:  
       case 10:
       case 11:
       case 12:
       $colCls = 'col-md-4 col-sm-6 col-xs-12';
       break;
       default: 
       $colCls = 'col-md-4 col-sm-6 col-xs-12';
       break;
   }
   $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-service-thumb');
        $post = get_post();
        ?>
        <div class="row">
            <div class="<?php echo $colCls; ?> padding10 complete-serbox">
                <div class="serviceBox blue">
                    <div class="service-icon padding0 wow slideInLeft">                       

                       <?php
                       if (has_post_thumbnail()) {
                        $image_url = $lz_fitness_image[0];
                    } else {
                        $image_url = get_template_directory_uri() . '/images/service1.png';
                    }
                    ?>                                                          
                    <img class="img-responsive" src="<?php echo esc_url($image_url); ?>" alt="<?php the_title(); ?>" />

                </div>
                <a href="<?php the_permalink(); ?>"> <h3 class="title"><?php the_title(); ?></h3> </a>
                <p class="description"><?php 
                if(has_excerpt()){
                    echo get_the_excerpt();
                }else{
                    echo lz_fitness_excerpt( get_the_content() , 60 );
                }
                ?></p> 
                <?php
                $Servicessectionbutton = get_theme_mod('lz_fitness_Servicessection_txt', 'Read more '); 
                
                ?>
                <?php if( get_theme_mod('servicesusection_button_display','show' ) == 'show') :
                    ?>            
                    <a href="<?php the_permalink(); ?>" class="btn btn-lg red">
                        <?php echo ($Servicessectionbutton );  ?>

                    </a>
                <?php endif ?>
            </div>
            <div class="clearfix"></div>
            
            <!-- for inner page -->


<script>
    jQuery.noConflict();
    $(function(){
        function serviceinnerpagecontentboxHeight(){
            var ht = 0;
            $('div#content-box .service-innerpage-contentbox').each(function(i){
                var tHt = $(this).height();
                if(ht<tHt){
                    ht=tHt;
                }
            });
            $('div#content-box .service-innerpage-contentbox').height(ht+'px');
        }
        serviceinnerpagecontentboxHeight();
    });
    $( window ).resize(function(){
     serviceinnerpagecontentboxHeight();
 });
</script>        
<!-- for inner page -->
</div>
<?php
endwhile;
$text = ob_get_contents();
ob_clean();
endif;
wp_reset_postdata();
return $text;
}

/*gallery*/

    /**
     * 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 void
     * @author Luzuk <support@luzuk.com>
     * */

//testimonial new
function TestimonialShortCode($pageId = null, $isCustomizer = false, $i = null) {

    ob_start();

    $args = array('post_type' => 'our-testimonials');
    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }
    $args['posts_per_page'] = -1;
    $colCls = '';
    // if($isCustomizer == true){
    $cols = get_theme_mod('lz_fitness_testimonials_npp_count',2);  
    ++$cols;
    switch ($cols) {
       case 1:
       $colCls = 'col-md-12 col-sm-12 col-xs-12';
       break;
       case 2:
       case 3:
       case 4:
       case 5:
       case 6: 
       $colCls = 'col-md-12 col-sm-12 col-xs-12';
       break;
       default: 
       $colCls = 'col-md-12 col-sm-12 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-testimonials-thumb');
        if ($isCustomizer === true) {
            $lz_fitness_testimonials_designation = get_theme_mod('lz_fitness_testimonials_designation' . $i);
        }
        $post = get_post();
        $designation = get_post_meta($post->ID, 'designation', false);
        $lz_fitness_testimonials_designation = !empty($designation[0]) ? $designation[0] : '';
        
        ?>
        <div class="item">
        <div class="<?php echo $colCls; ?> timeline">
            <div class="testimonialsbox">
                  <div class="test-icon">
                     <img src="<?php echo (!empty($lz_fitness_image[0])) ? $lz_fitness_image[0] : get_template_directory_uri() . '/images/team-thumb.png' ?>" alt="" /> 
                   <!-- <img src="<?php echo esc_url(get_template_directory_uri().'/images/teamsec1.jpg');?>" alt="testimonials" /> -->
                  </div>

                <div class="timeline-content">                  
                 <div class="testimonial-box-content">
                    <h5 class="title"><?php the_title(); ?></h5>
                    <?php if (!empty($lz_fitness_testimonials_designation)) { ?>
                    <div class="post">(<?php echo ($lz_fitness_testimonials_designation); ?>)</div>
                    <?php } ?>
                    <p class="description">
                        <?php
                        if (has_excerpt()) {
                            echo get_the_excerpt( 45 );
                        } else {
                            //echo get_the_content( 50 );
                             echo wp_trim_words(get_the_content(), 45);
                        }
                        ?> 
                    </p>         
                 </div>
              </div>

              </div>            
                  
            <div class="clearfix"></div> 
        </div>
        <div class="clearfix"></div> 
    </div> <!-- item -->     


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

