<?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_count', 15);
    $cols++;
    switch($cols){
        case 1:
        $colCls = 'col-xl-12 col-md-12 col-sm-12 col-xs-12';
        break;
        case 2: 
        $colCls = 'col-xl-12 col-md-6 col-sm-6 col-xs-12';
        break;
        case 3:
        case 5:
        case 6:
        case 9:
        case 11:
        case 13:
        case 15:
        $colCls = 'col-xl-4 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();
        $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);
        } else {
            $team_area_facebook = '';
            $team_area_twitter = '';
           // $team_area_linkedin = '';
            $team_area_instagram = '';
            $team_area_pinterest = '';
            $team_area_designation = '';
        }

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

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

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

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

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

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

        ?>
        <div class="<?php echo $colCls;?> 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>
                <div class="team-text">
                    <h4 class="inner-area-title wow fadeInLeft" data-wow-duration="1s">
                        <?php the_title(); ?>
                    </h4>
                    <div class="team-designation wow fadeInLeft" data-wow-duration="2s">
                        <?php echo ($team_area_designation); ?>
                    </div>
                    <?php if ($team_area_facebook || $team_area_twitter || $team_area_instagram || $team_area_pinterest || $team_area_linkedin) { ?>
                        <div class="team-social-icon">
                            <?php if ($team_area_facebook) { ?> 
                                <li>
                                    <a target="_blank" href="<?php echo esc_url($team_area_facebook) ?>">
                                    <i class="fa fa-facebook"></i></a>
                                </li>
                            <?php } ?>
                            <?php if ($team_area_twitter) { ?>
                                <li>
                                    <a target="_blank" href="<?php echo esc_url($team_area_twitter) ?>" ><i class="fa fa-twitter"></i></a>
                                </li>
                            <?php } ?>
                            <?php if ($team_area_instagram) { ?>
                                <li>
                                    <a target="_blank" href="<?php echo esc_url($team_area_instagram) ?>" ><i class="fa fa-instagram"></i></a> 
                                </li>
                            <?php } ?>
                           <?php if ($team_area_pinterest) { ?>
                                <li>
                                    <a target="_blank" href="<?php echo esc_url($team_area_pinterest) ?>"><i class="fa fa-pinterest"></i></a>
                                </li>
                            <?php } ?>
                            <?php if ($team_area_linkedin) { ?>
                                <li>
                                    <a target="_blank" href="<?php echo esc_url($team_area_linkedin) ?>"><i class="fa fa-linkedin"></i></a>
                                </li>
                             <?php } ?>
                        </div>
                    <?php } ?>
                    <div class="clearfix"></div>
                </div>
            </div>
            <div class="clearfix"></div>
        </div>
<?php
    endwhile;
    $text = ob_get_contents();
    ob_clean();
    endif;
    wp_reset_postdata();
    return $text;
}

//team

/**
 * 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 testimonialthumbShortCode($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', 6);
    $testimonials_page = get_theme_mod('luzuk_testimonials_data'.$i);
     $testimonials_page_icon = get_theme_mod('testimonials_page_icon'.$i);
    $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) {
            
        }
        ++$postN;
        ?>
        <div class="swiper-slide">
             <div class="swiper-slide-container">
                <img src="<?php echo (!empty($luzuk_image[0])) ? $luzuk_image[0] : get_template_directory_uri() . '/images/team-thumb.png' ?>" class="slide-mainimg" alt="<?php the_title(); ?>" />
            </div>
        </div>
        <?php
        //$test++;
    endwhile;
    $text = ob_get_contents();
    ob_clean();
endif;
wp_reset_postdata();
return $text;

}

function testimonialtxtShortCode($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', 6);
    $testimonials_page = get_theme_mod('luzuk_testimonials_data'.$i);
     $testimonials_page_icon = get_theme_mod('testimonials_page_icon'.$i);
    $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) {
            
        }
        ++$postN;
        ?>
        <div class="item">
          <div class="ts-area">
              <div class="row">
                  <div class="col-xl-2 col-lg-3">
                      <div class="ts-area-thumb">
                          <img src="<?php echo (!empty($luzuk_image[0])) ? $luzuk_image[0] : get_template_directory_uri() . '/images/team-thumb.png' ?>" class="slide-mainimg" alt="<?php the_title(); ?>" />
                      </div>
                  </div>
                  <div class="col-xl-10 col-lg-9">
                      <div class="ts-area-content">
                          <div class="ts-area-bx">
                              <p class="ts-area-title "><?php the_title(); ?></p>
                              <div class="text-designation">
                                    (
                                        <?php
                                            $name2 = get_post_meta($post->ID, 'testimonial_Sub_Title', false);
                                            echo (!empty($name2[0])) ? $name2[0] : '';
                                        ?> 
                                    )
                                </div>
                          </div>
                          <div class="ts-area-c">   
                               <p><?php
                                    if (has_excerpt()) {
                                        echo get_the_excerpt();
                                    } else {
                                        echo get_the_content();
                                    }
                                    ?>       
                                </p>  
                          </div> 
                          <div class="ts-quote">
                            <i class="fa fa-quote-left" aria-hidden="true"></i>
                          </div>
                      </div>
                  </div>
              </div>
          </div>
      </div>
        <?php
        //$test++;
    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-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:
        case 13:
        case 15:
        $colCls = 'col-md-4 col-sm-6';
        break;
        default: 
        $colCls = '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-service-thumb');
            $post = get_post();

        ?>
        <div class="item">
            <div class="single-service-bx" data-wow-duration="1s">
                <div class="single-service">
                    <div class="service-icon">
                        <a href="<?php the_permalink(); ?>">
                            <span><i class="<?php echo $services_page_icon1; ?>" aria-hidden="true"></i></span>
                       </a>
                    </div>
                     <a href="<?php the_permalink(); ?>">
                        <h4 class="post-title inner-area-title wow fadeInDown"><?php the_title(); ?></h4>
                    </a>
                </div>
                <div class="service-border"></div>
                <div class="sertxbx">
                    <p> 
                        <?php
                            if(has_excerpt()){
                              echo get_the_excerpt();
                             }else{
                              echo luzuk_excerpt( get_the_content() , 150 );
                             } 
                        ?>
                    </p>
                    <div class="serbtn">  
                        <a href="<?php echo esc_url(get_permalink()); ?>">
                            <span>Read Now</span>
                        </a>
                    </div> 
                </div>
            </div> 
        </div>

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



/*Lands Shortcode*/
function landsShortCode($pageId = null, $isCustomizer = false, $i = null) {

    ob_start();

    $args = array('post_type' => 'our-lands');
    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }
    $args['posts_per_page'] = -1;
    $colCls = '';
    // if($isCustomizer == true){
    $cols = get_theme_mod('land_npp_count',5);  
    //$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:
        case 13:
        case 15:
        $colCls = 'col-md-4 col-sm-6';
        break;
        default: 
        $colCls = '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_land_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'total-land-thumb');
            $post = get_post();

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

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

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

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

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

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

        $currencies = get_currency_options();
        $currency_symbol = get_theme_mod('currency_symbol', 'USD');
        $current_currency_symbol = $currencies[$currency_symbol];

        ?>
        <div class="item">
            <div class="single-land-bx" data-wow-duration="1s">
                <div class="single-land" data-match-height="single-service ">
                    <div class="land-icon">
                        <a href="<?php the_permalink(); ?>">
                            <?php
                                if (has_post_thumbnail()) {
                                    $image_url = $luzuk_land_image[0];
                                } else {
                                    $image_url = get_template_directory_uri() . '/images/land.jpg';
                                }
                            ?>                  
                            <img src="<?php echo esc_url($image_url); ?>" alt="<?php the_title(); ?>" />
                       </a>
                    </div>
                    <div class="landdetailbx">
                        <?php 
                            if($land_area_Dimension){
                        ?>
                            <div class="land-location">
                                <i class="fa fa-map-marker" aria-hidden="true"></i>
                                <?php echo $land_area_location; ?>
                            </div>
                        <?php } ?>
                        <a href="<?php the_permalink(); ?>">
                            <h4 class="post-title inner-area-title wow fadeInDown"><?php the_title(); ?></h4>
                        </a>
                        <?php 
                            if(!empty($land_area_Dimension) || !empty($land_area_area)){
                         ?>
                            <div class="land-areadata">
                                <?php 
                                    if($land_area_Dimension){
                                ?>
                                    <span class="size">
                                            <i class="fa fa-square-o" aria-hidden="true"></i>
                                            <?php echo $land_area_Dimension; ?>
                                    </span>
                                <?php } ?>
                                <?php 
                                    if($land_area_area){
                                ?>
                                    <span class="distance">
                                            <i class="fa fa-line-chart" aria-hidden="true"></i>
                                            <?php echo $land_area_area; ?>
                                    </span>
                                <?php } ?>
                            </div>
                        <?php } ?>
                        <div class="land-info">
                            <?php 
                                if($land_area_buttontxt){
                             ?>
                                <div class="landbtn">
                                    <a href="<?php echo $land_area_buttonlink; ?>">
                                        <span><?php echo $land_area_buttontxt; ?></span>
                                    </a>
                                </div>
                            <?php } ?>
                            <?php 
                                if($land_area_price){
                             ?>
                                <div class="land-price">
                                      <span>Great Price</span>
                                      <?php echo $current_currency_symbol,'',$land_area_price;?>
                                </div>  
                            <?php } ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
            <?php
        endwhile;
        $text = ob_get_contents();
        ob_clean();
    endif;
    wp_reset_postdata();
    return $text;
}


/*Homes Shortcode*/
function homeShortCode($pageId = null, $isCustomizer = false, $i = null) {

    ob_start();

    $args = array('post_type' => 'our-homes');
    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }
    $args['posts_per_page'] = -1;
    $colCls = '';
    // if($isCustomizer == true){
    $cols = get_theme_mod('home_npp_count',5);  
    //$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:
        case 13:
        case 15:
        $colCls = 'col-md-4 col-sm-6';
        break;
        default: 
        $colCls = '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_home_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'total-land-thumb');
            $post = get_post();

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

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

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

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

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

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

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

        $currencies = get_currency_options();
        $currency_symbol = get_theme_mod('currency_symbol', 'USD');
        $current_currency_symbol = $currencies[$currency_symbol];

        ?>
        <div class="item">
            <div class="single-home-bx" data-wow-duration="1s">
                <div class="single-home " ser-match-height>
                    <div class="home-icon">
                        <a href="<?php the_permalink(); ?>">
                            <?php
                                if (has_post_thumbnail()) {
                                    $image_url = $luzuk_home_image[0];
                                } else {
                                    $image_url = get_template_directory_uri() . '/images/land.jpg';
                                }
                            ?>                  
                            <img src="<?php echo esc_url($image_url); ?>" alt="<?php the_title(); ?>" />
                       </a>
                    </div>
                </div>
                <div class="homedetailbx">
                    <div class="home-location">
                        <i class="fa fa-map-marker" aria-hidden="true"></i>
                        <?php echo $home_area_location; ?>
                    </div>
                    <a href="<?php the_permalink(); ?>">
                        <h4 class="post-title inner-area-title wow fadeInDown"><?php the_title(); ?></h4>
                    </a>
                    <div class="home-areadata">
                        <span class="bed">
                            <i class="fa fa-bed" aria-hidden="true"></i>
                            <?php echo $home_area_bed; ?>
                        </span>
                        <span class="size">
                                <i class="fa fa-square-o" aria-hidden="true"></i>
                                <?php echo $home_area_Dimension; ?>
                        </span>
                        <span class="distance">
                                <i class="fa fa-line-chart" aria-hidden="true"></i>
                                <?php echo $home_area_area; ?>
                        </span>
                    </div>
                    <div class="home-info">
                        <?php
                            if($home_area_buttonlink){
                        ?>
                            <div class="homebtn">
                                <a href="<?php echo $home_area_buttonlink; ?>"><span><?php echo $home_area_buttontxt; ?></span></a>
                            </div>
                        <?php } ?>
                         <?php
                            if($home_area_price){
                        ?>
                            <div class="home-price">
                                <span>Great Price</span>
                                <?php echo $current_currency_symbol,'',$home_area_price;?>
                            </div>  
                        <?php } ?>
                    </div>
                </div>
            </div>              
        </div>
            <?php
        endwhile;
        $text = ob_get_contents();
        ob_clean();
    endif;
    wp_reset_postdata();
    return $text;
}

// ==========================
/*********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-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-4 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(), 'medium_large');
            $post = get_post();
            ?> 

      <div class="gall-contain wow zoomIn">  
        <div class="homegalry"> 
            <div class="lz-gallery-images">
                <figure class="spa-gall">
                    <?php
                        if (has_post_thumbnail()) {
                            $image_url = $luzuk_image[0];
                        } else {
                            $image_url = get_template_directory_uri() . '/images/about1.jpg';
                        }
                    ?>
                    <a data-fancybox="gallery" href="<?php echo esc_url($image_url); ?>" title="<?php the_title(); ?>" data-caption="<?php the_title(); ?>">  
                        <img src="<?php echo esc_url($image_url); ?>" alt="<?php the_title(); ?>" />
                        <div class="gall-imgovly"></div>
                        <div class="over-text">
                            <i class="fa fa-scissors" 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;
}

