<?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('team_area_npp_count1', 15);
    $cols++;
    switch($cols){
        case 1:
        $colCls = 'col-lg-12 col-md-12 col-sm-12';
        break;
        case 2: 
        $colCls = 'col-lg-6 col-md-6 col-sm-6';
        break;
        case 3:
        case 5:
        case 6:
        case 9:
        case 11:
        case 13:
        case 15:
        $colCls = 'col-lg-4 col-md-4 col-sm-6';
        break;
        default: 
        $colCls = 'col-lg-3 col-md-4 col-sm-6';
        break;
    } 

    // } 
 $text = '';
 $query = new WP_Query($args);
 if ($query->have_posts()):
    $postN = 0;

    while ($query->have_posts()) : $query->the_post();
        $team_area_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'total-team-thumb');
        if ($isCustomizer === true) {
            $team_area_designation = get_theme_mod('team_area_designation' . $i);
           //  $team_area_facebook = get_theme_mod('team_area_facebook' . $i);
           //  $team_area_twitter = get_theme_mod('team_area_twitter' . $i);
           // // $team_area_linkedin = get_theme_mod('team_area_linkedin' . $i);
           //  $team_area_instagram = get_theme_mod('team_area_instagram' . $i);
           //  $team_area_pinterest = get_theme_mod('team_area_pinterest' . $i);

            $team_area_age = get_theme_mod('team_age' . $i);
            $team_area_experience = get_theme_mod('team_experience' . $i);
            $team_area_height = get_theme_mod('team_height' . $i);
            $team_area_weight = get_theme_mod('team_weight' . $i);
            $team_area_goals = get_theme_mod('team_goals' . $i);
            $team_area_matches = get_theme_mod('team_matches' . $i);
            $team_area_awards = get_theme_mod('team_awards' . $i);
        } else {
            // $team_area_facebook = '';
            // $team_area_twitter = '';
            // $team_area_instagram = '';
            // $team_area_pinterest = '';
            $team_area_designation = '';
            $team_area_age = '' ;
            $team_area_experience = '' ;
            $team_area_height = '' ;
            $team_area_weight = '' ;
            $team_area_goals = '' ;
            $team_area_matches = ''  ;
            $team_area_awards = '' ;
        }

        $post = get_post();

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

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

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

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

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

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

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

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

        ?>
        <div class="item">
            <div class="single-team wow zoomIn"> 
                <div class="our-team ">
                    <div class="single-team-img">
                        <?php
                            if (has_post_thumbnail()) {
                                $image_url = $team_area_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-overlay"></div>
                    </div>
                    <div class="team-text">
                        <h4 class="inner-area-title wow fadeInLeft" data-wow-duration="1s">
                               <?php the_title(); ?>
                        </h4>
                        <?php if($team_area_designation ){ ?>      
                            <div class="team-designation wow fadeInLeft" data-wow-duration="2s"> 
                                <?php echo ($team_area_designation); ?> 
                            </div>
                        <?php }?>
                        <?php if ($team_area_age || $team_area_experience || $team_area_height || $team_area_weight || $team_area_goals || $team_matches || $team_area_awards) { ?>
                            <div class="team-content">
                                <?php if ($team_area_age) { ?>
                                    <li>
                                        <div class="team-list"> Age </div> 
                                        <div class="team-details"> <?php echo $team_area_age; ?> </div> 
                                    </li>
                                <?php } ?>
                                <?php if ($team_area_experience) { ?>
                                    <li>
                                        <div class="team-list"> Experience </div> 
                                        <div class="team-details"> <?php echo $team_area_experience; ?> </div> 
                                    </li>
                                <?php } ?>
                                <?php if ($team_area_height) { ?>
                                    <li>
                                        <div class="team-list"> Height </div> 
                                        <div class="team-details"> <?php echo $team_area_height; ?> </div> 
                                    </li>
                                <?php } ?>
                                <?php if ($team_area_weight) { ?>
                                    <li>
                                        <div class="team-list"> Weight </div> 
                                        <div class="team-details"> <?php echo $team_area_weight; ?> </div> 
                                    </li>
                                <?php } ?>
                                <?php if ($team_area_goals) { ?>
                                    <li>
                                        <div class="team-list"> Goals </div> 
                                        <div class="team-details"> <?php echo $team_area_goals; ?> </div> 
                                    </li>
                                <?php } ?>
                                <?php if ($team_area_matches) { ?>
                                    <li>
                                        <div class="team-list"> Matches </div> 
                                        <div class="team-details"> <?php echo $team_area_matches; ?> </div> 
                                    </li>
                                <?php } ?>
                                <?php if ($team_area_awards) { ?>
                                    <li>
                                        <div class="team-list"> Awards </div> 
                                        <div class="team-details"> <?php echo $team_area_awards; ?> </div> 
                                    </li>
                                <?php } ?>
                            </div>
                         <?php } ?>
                    </div> 
                    <div class="clearfix"></div>
                </div>
            </div> 
        </div> 

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


//team Inner Page

/**
 * 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();
            $luzuk_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'total-team-thumb');
        $post = get_post();

            if (($postN % 3) == 0 && $isCustomizer == false) {
                ?>
                <!-- <div class="clearfix"></div> -->
            <!-- </div> -->
            <!-- <div class="row"> -->
                <?php
            }
            ++$postN;
    ?>
        <div class="client-single inactive position-<?php echo $i; ?>" data-position="position-<?php echo $i; ?>">
            <div class="client-img">
                <img src="<?php echo (!empty($luzuk_image[0])) ? $luzuk_image[0] : get_template_directory_uri() . '/images/team-thumb.png' ?>" class="img-responsive" alt="<?php the_title(); ?>" />
            </div>
            <div class="client-comment">
                <span>
                  <svg height="30px" width="30px" version="1.1" id="Capa_1" viewBox="0 0 32 32" >
                    <g id="SVGRepo_bgCarrier" stroke-width="0"></g>
                    <g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
                    <g id="SVGRepo_iconCarrier"> 
                      <g> 
                        <g id="right_x5F_quote"> 
                          <g> 
                              <path d="M0,4v12h8c0,4.41-3.586,8-8,8v4c6.617,0,12-5.383,12-12V4H0z"></path> 
                              <path d="M20,4v12h8c0,4.41-3.586,8-8,8v4c6.617,0,12-5.383,12-12V4H20z"></path> 
                          </g> 
                        </g> 
                      </g> 
                    </g>
                  </svg>
                </span>
                <p>
                    <?php
                        if (has_excerpt()) {
                            echo get_the_excerpt();
                        } else {
                            echo get_the_content();
                        }
                    ?>  
                </p>
            </div>
            <div class="client-info">
                <p><?php the_title(); ?></p>
            </div>
        </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',3);  
    $services_page_icon1 = get_theme_mod('services_page_icon1'.$i);
    ++$cols;
    switch ($cols) {
        case 1:
        $colCls = 'col-lg-12 col-md-12 col-sm-12';
        break;
        case 2: 
        $colCls = 'col-lg-6 col-md-6 col-sm-6';
        break;
        case 3:
        case 5:
        case 6:
        case 9:
        case 11:
        case 13:
        case 15:
        $colCls = 'col-lg-4 col-md-6 col-sm-6';
        break;
        default: 
        $colCls = 'col-lg-3 col-md-6 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();
        ?>
        <!-- <div class="</?php echo $colCls; ?> single-service-bx wow zoomIn">  -->
        <div class="<?php echo $colCls;?> single-service-bx wow zoomIn">
            <div class="single-service ">
                <div class="service-icon">
                    <a href="<?php the_permalink(); ?>">
                        <?php
                            if (has_post_thumbnail()) {
                                $image_url = $luzuk_image[0];
                            } else {
                                $image_url = get_template_directory_uri() . '/images/services.jpg';
                            }
                        ?>                                                        
                        <img class="img-responsive" src="<?php echo esc_url($image_url); ?>" alt="<?php the_title(); ?>" />
                        <div class="service-overlay"></div>
                     </a>
                </div>
                <div class="sertxbx">
                    <a href="<?php the_permalink(); ?>">
                        <h4 class="post-title inner-area-title "><?php the_title(); ?></h4>
                    </a>
                    <p class="section-area-text">
                        <?php
                            if(has_excerpt()){
                              echo get_the_excerpt();
                             }else{
                              echo luzuk_excerpt( get_the_content() , 80 );
                             } 
                        ?>
                    </p>
                    <div class="serbtn btn2">
                        <a href="<?php the_permalink(); ?>">
                            <i class="fa fa-arrow-right" aria-hidden="true"></i>
                        </a>
                    </div>  
                    <div class="clearfix"></div>        
                </div>  
                <div class="clearfix"></div>                        
            </div>
        </div>
        <!-- inner-page -->
            <?php
        endwhile;
        $text = ob_get_contents();
        ob_clean();
    endif;
    wp_reset_postdata();
    return $text;
}

// service innerpage {shortcode}
/*services*/

// price 
// ****************


// **************************
// ======projects =========
// **************************

function projectShortCode($pageId = null, $isCustomizer = false, $i = null) {

    ob_start();
     global $post;
    $args = array('post_type' => 'our-projects');
    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }
    $args['posts_per_page'] = -1;
    $colCls = '';
    // if($isCustomizer == true){
    $cols = get_theme_mod('project_npp_count',3);  
    $projects_page_icon1 = get_theme_mod('projects_page_icon1'.$i);

    ++$cols;
    switch ($cols) {
        case 1:
        $colCls = 'col-lg-12 col-md-12 col-sm-12';
        break;
        case 2: 
        $colCls = 'col-lg-6 col-md-6 col-sm-6';
        break;
        case 3:
        case 5:
        case 6:
        case 9:
        case 11:
        case 13:
        case 15:
        $colCls = 'col-lg-4 col-md-4 col-sm-6';
        break;
        default: 
        $colCls = 'col-lg-3 col-md-4 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-project-thumb');
               global $post;

                $image_id  = get_post_meta( $post->ID, 'second_featured_image', true );
                $image_src = wp_get_attachment_url( $image_id );
              
                //   if ($isCustomizer === true) {
                //         $projtsubttle = get_theme_mod('projtsubttle' . $i);
                //     } else {
                //         $projtsubttle = '';
                //     }
                // $post = get_post();
                // $projtsubttle = get_post_meta($post->ID, 'projtsubttle', false);
                //echo the_post_thumbnail( 'project-featured-thumbnail' );
                // $projt_area = !empty($projtsubttle[0]) ? $projtsubttle[0] : '';
                // $projectsNum = get_post_meta($post->ID, 'projectsNum', false);
                //$projects_Num = !empty($projectsNum[0]) ? $projectsNum[0] : '';
                ?>

                
        <!-- <div class="</?php echo $colCls;?> single-project-bx"> -->
        <div class="item single-project-bx">
            <div class="main-project ">
                <div class="single-project ">
                    <div class="project-icon">
                       <?php
                            if (has_post_thumbnail()) {
                                $image_url = $luzuk_image[0];
                            } else {
                                $image_url = get_template_directory_uri() . '/images/project.png';
                            }
                        ?>
                        <div class="row">
                            <div class="col-md-6">
                                <a href="<?php the_permalink(); ?>">
                                   <div class="project-img">
                                        <div class="project-tag left-tag">Before</div>
                                        <img class="img-responsive" src="<?php echo esc_url($image_url); ?>" alt="<?php the_title(); ?>" />
                                    
                                    </div> 
                                </a>
                            </div>
                            <div class="col-md-6">
                                <a href="<?php the_permalink(); ?>">
                                   <div class="project-img2 ">
                                      <div class="project-tag right-tag">After</div>
                                        <img id="img-responsive" src="<?php echo $image_src ?>" alt="<?php the_title(); ?>" />
                                       
                                    </div> 
                                </a>
                            </div>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>  
            </div>
        </div>

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



//projectpage
// ==========================
/*********gallery************/ 
// ==========================

function galleryShortCode($pageId = null, $isCustomizer = false, $i = null) {

    ob_start();

    $args = array('post_type' => 'our-gallery');
    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }
    $args['posts_per_page'] = -1;
    $colCls = '';
    // if($isCustomizer == true){
    $cols = get_theme_mod('luzuk_gallery_npp_count', 7);  
    ++$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:
                    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;
    }
    // }
    $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(), 'medium_large');
            $post = get_post();
        ?> 
        <div class="gall-contain wow zoomIn">
            <div class="homegalry ">
                <div class="lz-gallery-images ">
                    <?php
                        if (has_post_thumbnail()) {
                            $image_url = $luzuk_image[0];
                        } else {
                            $image_url = get_template_directory_uri() . '/images/about1.jpg';
                        }
                    ?>
                    <figure class="spa-gall">
                        <a data-fancybox="gallery" href="<?php echo esc_url($image_url); ?>" title="<?php the_title(); ?>"> 
                           <img class="secondry-bg img-responsive" src="<?php echo esc_url($image_url); ?>" alt="<?php the_title(); ?>" />
                            <div class="gall-imgovly"></div>
                            <div class="over-text">
                                <i class="fa fa-futbol-o" aria-hidden="true"></i>
                            </div>
                        </a>
                    </figure>
                </div>
                <div class="clearfix"></div>
            </div>
        </div>  
            <?php
        endwhile;
        $text = ob_get_contents();
        ob_clean();
    endif;
    wp_reset_postdata();
    return $text;
}

