<?php
       
//faq
           function faqShortcode($isHome = 0) {
            global $query;

            $args = array('post_type' => 'our-faq');

            if (!empty($pageId)) {
                $args['page_id'] = absint($pageId);
            } else {
                $args['paged'] = max(1, get_query_var('paged'));
            }

            if(!empty($isHome) && $isHome == 1){
                $cols = get_theme_mod('faq_section_npp_count', 5);
                $cols++;
                $args['posts_per_page'] = $cols;
            }else{
                $args['posts_per_page'] = (!empty($args['posts_per_page'])) ? $args['posts_per_page'] : -1;
         // $cols = 5;
            }
            $faqPageId = get_theme_mod('faq_section_page_link');
            $query = new WP_Query($args);

            ob_start();?>
        
        <div class=" faqrhsbx " >

            <?php
    // print_r($query);
            echo '<div class="faqinn row">';
            if ($query->have_posts()){
                while ($query->have_posts()) : $query->the_post();
                $post = get_post();
                //$count_posts = $query->current_post + 01;
            ?>

            <div class=" faq-content ">            
                <button class="accordion"> 
                    <h3 class="faq-title"> <?php the_title(); ?></h3>
                </button>
                <div class="panel">
                    <div class="faq-description"> 
                        <p><?php
                           if(!empty($isHome) && $isHome==1){
                            if (has_excerpt()) {
                                echo get_the_excerpt();
                            } else {
                                    //echo luzuk_excerpt(get_the_content(),300);
                               echo get_the_content();
                           }
                                    // if(!empty($faqPageId)){
                                    //     echo '<a href="'.get_permalink($faqPageId).'">Read More..</a>';
                                    // }else{
                                    //     echo '<a href="'.get_permalink($faqPageId).'">Read More..</a>';
                                    // }
                           }else{
                            echo get_the_content();
                            }?>  
                        </p>
                    </div>
                </div>
            </div>     

        
    <?php
endwhile;
}else{
    for($i=0; $i<$cols; $i++){
        ?>
        <!-- <div class="row"> -->
            <div class="faq-content">
                <button class="accordion"> 
                    <h3 class="faq-title">Lorem Ipsum is simply dummy text of the printing and typesetting industry?</h3>
                </button>
                <div class="panel">
                <div class="faq-description">
                    <p><?php
                    if(!empty($isHome) && $isHome==1){
                        ?>
                        Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. Lorem Ipsum is simply dummy text of the printing  typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.
                        <br>
                        <?php
                                // if(!empty($faqPageId)){
                                //     echo '<a href="'.get_permalink($faqPageId).'">Read More..</a>';
                                // }else{
                                //     echo '<a href="'.get_permalink($faqPageId).'">Read More..</a>';
                                // }
                            }else{
                            ?>
                            Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. Lorem Ipsum is simply dummy text of the printing  typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.

                            Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. Lorem Ipsum is simply dummy text of the printing  typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.
                            <?php
                        }?>
                    </p>
                </div>  
            </div>
        </div>

    <!-- </div> -->
    <?php   
}
}
echo '</div>';

?> 
    <div class="clearfix"></div>
 
<script>
    var acc = document.getElementsByClassName("accordion");
    var i;

    for (i = 0; i < acc.length; i++) {
        acc[i].onclick = function(){
            this.classList.toggle("active");
            this.nextElementSibling.classList.toggle("show");
        }
    }
</script>

<?php
$text = ob_get_contents();
ob_clean();
ob_end_flush();
wp_reset_postdata();
    // echo $text;
return $text;
}


//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 col-xs-12';
        break;
        case 2: 
        $colCls = 'col-lg-6 col-md-6 col-sm-6 col-xs-6';
        break;
        case 3:
        case 5:
        case 6:
        case 9:
        case 11:
        case 13:
        case 15:
        $colCls = 'col-lg-3 col-md-6 col-sm-6 col-xs-6';
        break;
        default: 
        $colCls = 'col-lg-3 col-md-6 col-sm-6 col-xs-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);
        } 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"> 
            <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-text">
                        <h4 class="inner-area-title wow fadeInLeft" ><?php the_title(); ?></h4> 
                         <?php if($team_area_designation ){ ?>      
                        <div class="team-designation wow fadeInLeft"> <?php echo ($team_area_designation); ?> </div>
                        <?php }?>                     
                   
                        <?php if ($team_area_facebook || $team_area_twitter || $team_area_instagram || $team_area_pinterest) { ?>
                        <div class="team-social-icon">
                            <?php if ($team_area_facebook) { ?>
                            <a target="_blank" href="<?php echo esc_url($team_area_facebook) ?>">
                                <i class="fa fa-facebook"></i></a>
                            <?php } ?>
                            <?php if ($team_area_twitter) { ?>
                            <a target="_blank" href="<?php echo esc_url($team_area_twitter) ?>" ><i class="fa-brands fa-x-twitter"></i></a>
                            <?php } ?>
                            <?php if ($team_area_instagram) { ?>
                            <a target="_blank" href="<?php echo esc_url($team_area_instagram) ?>" ><i class="fa fa-instagram"></i></a> 
                            <?php } ?>
                           <?php if ($team_area_pinterest) { ?>
                            <a target="_blank" href="<?php echo esc_url($team_area_pinterest) ?>"><i class="fa fa-pinterest"></i></a>
                            <?php } ?>
                        </div>
                        <?php } ?>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div> 
        </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>
 * */
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="item items innertest-item ">        
        <div class="ts-area-single ">
            <?php if (get_theme_mod('ts_button_display', 'show') == 'show') : ?>
            <div class="ratingbx">
                <?php
                    $ts_rating = get_post_meta(get_the_ID(), '_luzuk_star_rating', true);
                    $ts_rating = !empty($ts_rating) ? intval($ts_rating) : 5; // Default fallback
                ?>      
                <div class="rating-container">                     
                    <div class="rating-display">
                        <?php for ($j = 1; $j <= 5; $j++) : ?>
                            <i class="fa fa-star<?php echo ($j <= $ts_rating) ? '' : '-o'; ?>"></i>
                        <?php endfor; ?>
                    </div>
                         
                </div>
            </div>
             <?php endif; ?>
            <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-content">   
                    <div class=" ts-area-bx">
                        <h3 class="ts-area-title "><?php the_title(); ?></h3>
                        <div class="text-designation">
                            <?php
                                $name2 = get_post_meta($post->ID, 'testimonial_Sub_Title', false);
                                echo (!empty($name2[0])) ? $name2[0] : '';
                            ?> 
                        </div>  
                        <div class="clearfix"></div>    
                    </div>     
                <!-- </div>     -->
            </div> 
            <div class="clearfix"></div>
        </div>
    </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>
 * */
function testimonialinnShortCode($atts = [], $pageId = null, $isCustomizer = false, $i = null) {
    // Shortcode attributes
    $atts = shortcode_atts(array(
        'class' => 'testinninn', // default is empty
    ), $atts);

    $custom_class = esc_attr($atts['class']);

    ob_start();

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

    $args = array(
        'post_type' => 'our-testimonial',
        'posts_per_page' => 9,
        'paged' => $paged
    );

    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }

    $cols = get_theme_mod('test_npp_count', 5);
    $cols++;

    $icons = array(1 => 'heart', 2 => 'star', 3 => 'flash', 4 => 'bell', 5 => 'heart', 6 => 'star', 7 => 'flash', 8 => 'bell');

     $query = new WP_Query($args);
    if ($query->have_posts()):
    ?>
    <div class="row mr-0 testimonial-wrapper">

    <?php
        while ($query->have_posts()) : $query->the_post();
        $post = get_post();
        $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'total-team-thumb');
          $luzuk_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'total-team-thumb');
    $post = get_post();
        $subTitle = get_post_meta(get_the_ID(), 'testimonial_Sub_Title', true);
    ?>
        
    <div class="item innertest-item ">    
        <div class=" tsarea-inn">        
            <div class="ts-area-content">       
                <p>
                    <?php
                    if (has_excerpt()) {
                        echo get_the_excerpt();
                    } else {
                        echo get_the_content();
                    }
                    ?> 
                </p>                                                        
            </div>  
            <div class="row mr-0">
                 <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-fluid" alt="<?php the_title(); ?>" />
                </div>
                <div class=" ts-area-bx">
                    <h4 class="ts-area-title "><?php the_title(); ?></h4>
                    <div class="text-designation">
                        <?php
                            $name2 = get_post_meta($post->ID, 'testimonial_Sub_Title', false);
                            echo (!empty($name2[0])) ? $name2[0] : '';
                        ?>    
                    </div>                  
                </div>
            </div>
                                            
            <div class="clearfix"></div>           
        </div>     
        <!--innerpage end-->
    </div>

     <?php
        endwhile;
        ?>
        <!-- PAGINATION -->
        <div class="testimonial-pagination pagingation">
            <?php
            echo paginate_links(array(
                'total' => $query->max_num_pages,
                'current' => $paged,
                'format' => '?paged=%#%',
                'prev_text' => __('« Prev'),
                'next_text' => __('Next »'),
            ));
            ?>
        </div>
        </div>

        
        <?php
    endif;

    wp_reset_postdata();
    return ob_get_clean();
}

// ***********end********************


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

        $service_icon = get_post_meta(get_the_ID(), '_service_icon', true);

        ?>
        <!-- <div class="</?php echo $colCls; ?> single-service-bx ">  -->
        <div class="<?php echo $colCls;?> single-service-bx">
            <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(); ?>" />
                    <!-- <i class="</?php echo $service_icon; ?>"></i> -->
                    </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() , 110 );
                             } 
                        ?>
                    </p>
                    <?php
                        $ser_button = get_theme_mod('ser_button', 'Read More');
                    ?>
                    <?php if($ser_button) { ?>
                    <div class="s-btn">
                        <a href="<?php the_permalink(); ?>">
                            <?php echo ($ser_button);  ?>
                        </a>
                    </div>
                    <?php }?>
                    <div class="clearfix"></div>
                </div>             
                         
            </div> 
        </div>
            <?php
        endwhile;
        $text = ob_get_contents();
        ob_clean();
    endif;
    wp_reset_postdata();
    return $text;
}

// service innerpage {shortcode}
/*services*/
function serviceinnerShortCode($pageId = null, $isCustomizer = false, $i = null) {
    ob_start();

    // Get current pagination page
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

    $args = array(
        'post_type' => 'our-services',
        'posts_per_page' => 8,
        'paged' => $paged
    );

    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }

    $cols = get_theme_mod('service_npp_count', 3);  
    ++$cols;

        switch ($cols) {
        case 1:
        $colCls = 'col-lg-12 col-md-12 col-sm-12 col-12';
        break;
        case 2: 
        $colCls = 'col-lg-6 col-md-6 col-sm-6 col-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-6 col-12';
        break;
        default: 
        $colCls = 'col-lg-4 col-md-6 col-sm-6 col-12';
        break;
    }

        $query = new WP_Query($args);
        if ($query->have_posts()):
    ?>
        <div class="row mr-0" >
            <?php
                while ($query->have_posts()) : $query->the_post();
                $luzuk_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'total-service-thumb');
                $service_icon = get_post_meta(get_the_ID(), '_service_icon', true);
                $image_url = has_post_thumbnail() ? $luzuk_image[0] : get_template_directory_uri() . '/images/services.jpg';
            ?>
        <!-- <div class="</?php echo $colCls; ?> single-service-bx ">  -->
        <div class="<?php echo $colCls; ?>  inn-single-service-bx ">
            <div class="singleinner-service">
                <?php 
                    $sertxtlimit = get_theme_mod('sertxtlimit', '110');
                ?> 
                <div class="service_inbox serviceinbox">   
                    <div class="service_inimg">                       
                       <?php
                        if (has_post_thumbnail()) {
                            $image_url = $luzuk_image[0];
                        } else {
                            $image_url = get_template_directory_uri() . '/images/services.jpg';
                        }
                        ?>         
                        <a href="<?php the_permalink(); ?>">                                             
                            <img class="img-responsive" src="<?php echo esc_url($image_url); ?>" alt="<?php the_title(); ?>" />
                        </a>          
                    </div> 
                    <div class="serbx">                       
                        <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 luzuk_excerpt(get_the_content(),$sertxtlimit );  
                               }
                            ?>        
                        </p>    
                        <?php
                            $ser_buttoninn = get_theme_mod('ser_buttoninn', 'Read More');
                        ?>
                        <?php if($ser_buttoninn) { ?>
                        <div class="s-btn">
                            <a href="<?php the_permalink(); ?>">
                                <?php echo ($ser_buttoninn);  ?>
                            </a>
                        </div>
                        <?php }?>                               
                    </div> 
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
        <?php endwhile; ?>
    </div>

    <!-- PAGINATION -->
    <div class="service-pagination pagingation">
        <?php
        echo paginate_links(array(
            'total'   => $query->max_num_pages,
            'current' => $paged,
            'format'  => '?paged=%#%',
            'prev_text' => __('« Prev'),
            'next_text' => __('Next »'),
        ));
        ?>
    </div>
        <?php
    endif;
    wp_reset_postdata();
    return ob_get_clean();
}



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

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

    $args = array(
        'post_type'      => 'our-projects',
        'posts_per_page' => -1,
    );

    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }

    $query = new WP_Query($args);

    if ($query->have_posts()) :
        

        $cols = get_theme_mod('project_npp_count', 2);
        $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-12'; break;
            case 3:  $colCls = 'col-lg-4 col-md-6 col-sm-12'; break;
            case 4:  $colCls = 'col-lg-3 col-md-6 col-sm-12'; break;
            default: $colCls = 'col-lg-4 col-md-6 col-sm-12'; break;
        }

        while ($query->have_posts()) : $query->the_post();

            $categories = wp_get_post_terms(get_the_ID(), 'projects_category', array('fields' => 'ids'));
            $categories_classes = implode(' ', array_map('esc_attr', $categories));

            $thumbnail = has_post_thumbnail()
                ? wp_get_attachment_image_src(get_post_thumbnail_id(), 'full')[0]
                : get_template_directory_uri() . '/images/project.png';

    
            $pj_makertxt = get_post_meta(get_the_ID(), 'pjmakertxt', true);
            $pj_button = get_theme_mod('pj_button', 'View Case Study');
        ?>

        <div class="<?php echo esc_attr($colCls); ?> single-project-bx" data-category="<?php echo esc_attr($categories_classes); ?>">
            <div class="single-project">
                <div class="project-icon">
                    <a href="<?php the_permalink(); ?>">
                        <img class="img-responsive" src="<?php echo esc_url($thumbnail); ?>" alt="<?php the_title(); ?>">
                        <div class="overlay"></div>
                    </a>
                    <div class="pj_conbx">
                        <a href="<?php the_permalink(); ?>">
                            <h4 class="title"><?php the_title(); ?></h4>
                        </a>
                        <p class="section-area-text">
                            <?php echo has_excerpt() ? get_the_excerpt() : wp_trim_words(get_the_content(), 10); ?>
                        </p>
                        <?php if ($pj_button): ?>
                        <div class="bttn">
                            <a href="<?php the_permalink(); ?>"><?php echo esc_html($pj_button); ?></a>
                        </div>
                        <?php endif; ?>
                    </div>
                    <?php if (get_theme_mod('pj_button_display', 'show') == 'show') : ?>
                    <div class="bxreview">
                        <div class="row mr-0">
                            <div class="imabx">   
                                <div class="pjimg">
                                    <?php
                                    $img2_url = get_post_meta(get_the_ID(), '_pj_img2', true);
                                    $img2_src = $img2_url ? esc_url($img2_url) : get_template_directory_uri() . '/images/team2.jpg';
                                    ?>
                                    <img src="<?php echo $img2_src; ?>" class="img-responsive secondry-bg-img" alt="Secondary Image">
                                </div>             
                            </div>
                            <div class="ratingbx">
                                <?php
                                    $rating = get_post_meta(get_the_ID(), '_luzuk_star_rating', true);
                                    $rating = !empty($rating) ? intval($rating) : 5; // Default fallback
                                ?>      
                                <div class="rating-container">                     
                                    <div class="rating-display">
                                        <?php for ($j = 1; $j <= 5; $j++) : ?>
                                            <i class="fa fa-star<?php echo ($j <= $rating) ? '' : '-o'; ?>"></i>
                                        <?php endfor; ?>
                                    </div>
                                    <div class="cltxt">  
                                        <?php echo esc_html(wp_trim_words($pj_makertxt, 10, '...')); ?>
                                    </div>      
                                </div>
                            </div>
                        </div>
                    </div>
                  
                    <?php endif; ?>
                </div>
            </div>
        </div>

        <?php endwhile;
    else :
        echo '<p>No projects found.</p>';
    endif;

    wp_reset_postdata();
    return ob_get_clean();
}



//project page inner

function projectinnerShortCode($pageId = null, $isCustomizer = false, $i = null) {
    ob_start();

    $paged = get_query_var('paged') ? get_query_var('paged') : 1;

    $args = array(
        'post_type'      => 'our-projects',
        'posts_per_page' => 8,
        'paged'          => $paged,
    );

    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }

    $cols = absint(get_theme_mod('project_npp_count', 3)) + 1;

    switch ($cols) {
        case 1:
            $colCls = 'col-12';
            break;
        case 2:
            $colCls = 'col-md-6 col-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-6 col-12';
            break;
        default:
            $colCls = 'col-lg-3 col-md-6 col-sm-6 col-12';
            break;
    }

    $query = new WP_Query($args);

    if ($query->have_posts()):
        $projecttxtlimit = get_theme_mod('projecttxtlimit', 80);
        $proj_buttoninn  = get_theme_mod('proj_buttoninn', 'View Case Study');
        ?>
        <div class="row mr-0"> <!-- Replace mr-0 with g-4 for Bootstrap 5 -->
            <?php while ($query->have_posts()) : $query->the_post();
                $image_url = has_post_thumbnail()
                    ? wp_get_attachment_image_url(get_post_thumbnail_id(), 'total-project-thumb')
                    : get_template_directory_uri() . '/images/project.jpg';

                $pj_makertxt = get_post_meta(get_the_ID(), 'pjmakertxt', true);
                $img2_url    = get_post_meta(get_the_ID(), '_pj_img2', true);
                $img2_src    = $img2_url ? esc_url($img2_url) : get_template_directory_uri() . '/images/team2.jpg';
                $rating      = intval(get_post_meta(get_the_ID(), '_luzuk_star_rating', true) ?: 5);
            ?>
            <div class="inn-single-project-bx">
                <div class="singleinner-project" >
                    <div class="project_inbox "> 
                    <div class="project_inimg">
                        <a href="<?php the_permalink(); ?>">
                            <img class="img-fluid" src="<?php echo esc_url($image_url); ?>" alt="<?php the_title(); ?>">
                            <div class="overlay"></div>
                        </a>
                    
                    <div class="projectbx">
                        <a href="<?php the_permalink(); ?>">
                        <h4 > 
                            <?php the_title(); ?>
                        </h4>
                        </a>
                         <p class="txt">
                            <?php 
                               if (has_excerpt()) {
                                        echo get_the_excerpt();
                                  } else {
                                      echo luzuk_excerpt(get_the_content(),$projecttxtlimit );  
                               }
                            ?>        
                        </p> 
                        <?php if ($proj_buttoninn): ?>
                        <div class="bttn">
                            <a href="<?php the_permalink(); ?>"><?php echo esc_html($proj_buttoninn); ?></a>
                        </div>
                        <?php endif; ?>

                        </div>
                        <?php if (get_theme_mod('pjinn_button_display', 'show') == 'show') : ?>
                        <div class="bxreview">
                            <div class="row mr-0">
                                <div class="imabx">   
                                    <div class="pjimg">
                                        <?php
                                        $img2_url = get_post_meta(get_the_ID(), '_pj_img2', true);
                                        $img2_src = $img2_url ? esc_url($img2_url) : get_template_directory_uri() . '/images/team2.jpg';
                                        ?>
                                        <img src="<?php echo $img2_src; ?>" class="img-fluid rounded-circle" alt="Secondary Image" width="50" height="50">
                                    </div>             
                                </div>

                                <div class="ratingbx">
                                    <?php
                                        $rating = get_post_meta(get_the_ID(), '_luzuk_star_rating', true);
                                        $rating = !empty($rating) ? intval($rating) : 5; // Default fallback
                                    ?>      
                                    <div class="rating-container">                     
                                        <div class="rating-display">
                                            <?php for ($j = 1; $j <= 5; $j++) : ?>
                                                <i class="fa fa-star<?php echo ($j <= $rating) ? '' : '-o'; ?>"></i>
                                            <?php endfor; ?>
                                        </div>
                                        <div class="cltxt">  <?php echo esc_html(wp_trim_words($pj_makertxt, 10, '...')); ?></div>      
                                    </div>
                                </div>
                            </div>
                        </div>
                        <?php endif; ?>
                    </div>
                </div>
                </div>
            </div>
            <?php endwhile; ?>
        </div>

        <!-- Pagination -->
        <div class="project-pagination pagingation mt-4">
            <?php
            echo paginate_links(array(
                'total'     => $query->max_num_pages,
                'current'   => $paged,
                'format'    => '?paged=%#%',
                'base'      => str_replace(999999999, '%#%', esc_url(get_pagenum_link(999999999))),
                'prev_text' => __('« Prev'),
                'next_text' => __('Next »'),
            ));
            ?>
        </div>
        <?php
    endif;

    wp_reset_postdata();
    return ob_get_clean();
}


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

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

    $args = array(
        'post_type' => 'our-gallery',
        'posts_per_page' => -1,
    );

    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }

    $query = new WP_Query($args);
    if ($query->have_posts()):

    ?>
        
    <div class="gallery-items gallery-sec">
        <?php 
        while ($query->have_posts()): 
            $query->the_post();
            
            // Get terms of the current post
            $terms = wp_get_post_terms(get_the_ID(), 'gallery_category');
            $term_ids = wp_list_pluck($terms, 'term_id'); // Get array of term IDs

            // Generate classes for the gallery item based on its categories
            $class_list = '';
            foreach ($term_ids as $id) {
                $class_list .= 'category-' . esc_attr($id) . ' ';
            }

            // Check if the post has a featured image
            if (has_post_thumbnail()) {
                $image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'total-service-thumb')[0];
            } else {
                // Fallback image URL if no featured image is set
                $image_url = get_template_directory_uri() . '/images/about1.jpg';
            }
        ?>
        <div class="lz-gallery-images">
            <figure class="spa-gall">
                <div class="gallery-item <?php echo trim($class_list); ?>">
                    <a data-fancybox="gallery" href="<?php echo esc_url($image_url); ?>" title="<?php the_title(); ?>">  
                        <img class="img-responsive" src="<?php echo esc_url($image_url); ?>" alt="<?php the_title(); ?>" />
                        <div class="g-oly"></div>
                    </a>
                </div>
            </figure>
        </div>
        <?php endwhile; ?>
    </div>
        
    <?php
    wp_reset_postdata();
    endif;

    $text = ob_get_clean();
    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 void
 * @author luzuk <support@luzuk.com>
 * */

//adding a shortcode 

