<?php
       
//faq



/**
 * 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', 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 innertest-item wow zoomIn">
            <div class="ts-area-single ">
                <div class="tsarea-inn" data-match-height="groupName">
                    <div class="ts-area-content">
                        <i class="fa fa-quote-left" aria-hidden="true"></i>  
                        <div class="ts-area-c">     
                            <p><?php
                                if (has_excerpt()) {
                                    echo get_the_excerpt();
                                } else {
                                    echo get_the_content();
                                }
                                ?>       
                            </p>    
                        </div>
                        <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] : '';
                                ?> 

                                <?php
                                    $name3 = get_post_meta($post->ID, 'testimonial_Profession', false);
                                    echo (!empty($name3[0])) ? $name3[0] : '';
                                ?> 
                            </div>
                        </div>
                        <i class="fa fa-quote-right" aria-hidden="true"></i>
                    </div>
                    <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="img-responsive" alt="<?php the_title(); ?>" />
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
            <div class="clearfix"></div>
        </div>
        <?php
        //$test++;
    endwhile;
    $text = ob_get_contents();
    ob_clean();
endif;
wp_reset_postdata();
return $text;

}




/**
 * Use for the show the pricing 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>
 * */
    function pricingShortcode() {
      ob_start();
      $cols = get_theme_mod('pricing_npp_count', 2);
      $cols++;
      switch ($cols) {
        case 1:
            $colCls = 'col-lg-12 col-md-12 col-sm-12 col-xs-12';
            break;
            case 2: 
            $colCls = 'col-lg-6 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-lg-4 col-md-6 col-sm-12 col-xs-12';
            break;
            default: 
            $colCls = 'col-lg-4 col-md-6 col-sm-12 col-xs-12';
            break;
    }

    $showStatic = true;
    for ($i = 1; $i <= $cols; $i++) {
        $PlanPageId = get_theme_mod('pricing_plan_page_' . $i);
        //$pricing_page_icon = get_theme_mod('pricing_plan_page_icon_'.$i);
        //$plannum  = get_theme_mod('plannum_' . $i, '01 ');

        $planTitle  = get_theme_mod('pricing_plan_name_' . $i, 'Unlimited');
        $planPrice  = get_theme_mod('pricing_plan_price_' . $i,'$30');
        $planmonth  = get_theme_mod('pricing_plan_month_' . $i,'rental');
        $planContent= get_theme_mod('pricing_plan_content_' . $i, '
            <li>Free backup size </li>
            <li>Free returns</li>
            <li>Free dry cleaning</li>
            <li>Free shipping & insurance</li>
            ');

        $link = get_theme_mod('pricing_plan_url'.$i);
        $url = get_theme_mod('pricing_plan_url_'.$i, '#');

        if ($planTitle  || $planPrice || $planmonth || $planContent || $url ) {
          $showStatic = false;
          ?>
    <div class="<?php echo $colCls; ?> price-mbx">
        <div class="single-pricing wow zoomIn">
            <div class="single-pricebox">
                <?php if($planPrice || $planmonth){ ?>
                    <div class="currency-price">
                        <?php echo ($planPrice); ?>
                        <small><?php echo ($planmonth); ?></small>
                    </div>
                <?php } ?>
                <div class="pr-s-area">
                    <h4 class="plan-title inner-area-title" ><?php echo ($planTitle); ?></h4>
                    <ul class="pricing-list "> <?php echo ($planContent); ?></ul>
                    <?php
                        $pricing_page_id = get_theme_mod('pricing_page');
                        $pricing_page_button_title = get_theme_mod('pricing_page_button_title_'.$i, 'Learn More');
                    ?>
                    <?php if($pricing_page_button_title){ ?>
                        <div class="pc-btn " data-wow-duration="4s">    
                            <a class="btn btn-lg" href="<?php echo esc_url(!empty($url)?$url:'#');?>" >
                               <span><?php echo ($pricing_page_button_title);  ?></span><i class="fa fa-long-arrow-right" aria-hidden="true"></i>
                            </a>
                        </div>
                    <?php } ?>
                    <div class="clearfix"></div>
                </div>   
             </div>
        </div>
        <div class="clearfix"></div> 
    </div>
    <?php
}
}
if ($showStatic === true) {
  for ($i = 1; $i <= $cols; $i++) {
    $link = get_theme_mod('pricing_plan_url'.$i);
    $url = get_theme_mod('pricing_plan_url_'.$i, '#');
}
}
$pricingHtml = ob_get_contents();
        // echo $pricingHtml;
ob_flush();
ob_clean();
}


// ==========================
/*********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="<?php echo $colCls; ?> gall-contain wow zoomIn">  
    <!-- <div class="item 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 class="group1" 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(); ?>" />
                    </a>
                 </figure> 
                <a class="group1" href="<?php echo esc_url($image_url); ?>" title="<?php the_title(); ?>"> 
                    <div class="over-text">
                        <i class="fa fa-plus" aria-hidden="true"></i>
                    </div>
                </a>
                    <!-- <a class="group1" href="<//?php echo esc_url($image_url); ?>" title="<//?php the_title(); ?>">
                        
                    </a> -->
                    <!-- <a class="group1" href="<?php //echo esc_url($image_url); ?>" title="<//?php the_title(); ?>"> -->
                        
                    <!-- </a>  -->
                
            </div>
            <div class="clearfix"></div>
        </div> 
        
        <script type="text/javascript">
                var title = 0;
            jQuery("#innerpage-box .lz-gallery-images").each(function(){
              if ($(this).height() > title) { title = $(this).height(); }
            });
            jQuery("#innerpage-box .lz-gallery-images").height(title);


            // on Resize change height

            jQuery(window).resize(function(){
              jQuery("#innerpage-box .lz-gallery-images").height("");
              var title = 0;
              jQuery("#innerpage-box .lz-gallery-images").each(function(){
                if ($(this).height() > title) { title = $(this).height(); }
              });
              jQuery("#innerpage-box .lz-gallery-images").height(title);
            });
        </script>
    </div>
                <?php
            endwhile;
            $text = ob_get_contents();
            ob_clean();
        endif;
        wp_reset_postdata();
        return $text;
    }


