<?php

/**
 * Liting the team/trainer details 
 * @param : int $pageId default is null
 * @param : boolean $isCustomizer default is false, if set to true will get the data stored with customizer
 * @param : int $i default is null, it will used as a iteration for data with customizer, this will be used only if the $isCustomizer is set to true.
 * @return: Text $text
 */
function teamShortCode($pageId = null, $isCustomizer = false, $i = null) {

    ob_start();

    $args = array('post_type' => 'lz_fitness_teams'); 
    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }
    $args['posts_per_page'] = -1;
    $colCls = '';
    // if($isCustomizer == true){
    $cols = get_theme_mod('lz_fitness_team_npp_count', 3);	
    ++$cols;
    switch ($cols) {
        case 1:
        $colCls = 'col-md-12 col-sm-12';
        break;
        case 2:
        $colCls = 'col-md-6 col-sm-6';
        break;
        case 4:
        case 7:
        case 8:
        $colCls = 'col-md-3 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();
            $lz_fitness_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'total-team-thumb');
            if ($isCustomizer === true) {
                $lz_fitness_team_designation = get_theme_mod('lz_fitness_team_designation' . $i);
                $lz_fitness_team_facebook = get_theme_mod('lz_fitness_team_facebook' . $i);
                $lz_fitness_team_twitter = get_theme_mod('lz_fitness_team_twitter' . $i);
                $lz_fitness_team_google_plus = get_theme_mod('lz_fitness_team_google_plus' . $i);
                $lz_fitness_team_pintrest = get_theme_mod('lz_fitness_team_pintrest' . $i);
            } else {
                $lz_fitness_team_facebook = '';
                $lz_fitness_team_twitter = '';
                $lz_fitness_team_google_plus = '';
                $lz_fitness_team_pintrest = '';
            }

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

            if (($postN % 4) == 0 && $isCustomizer == false) {
                ?>
                <div class="clearfix paddingBot20"></div>
                
                <div class="row">
                    <?php
                }
                ++$postN;
                ?>

                <div class="<?php echo $colCls; ?>">
                    <div class="ht-team-member paddingBot20">
                        <div class="ht-team-member-image">
                            <?php
                            if (has_post_thumbnail()) {
                                $image_url = $lz_fitness_image[0];
                            } else {
                                $image_url = get_template_directory_uri() . '/images/team-thumb.png';
                            }
                            ?>															
                            <img class="secondry-bg img-responsive" src="<?php echo esc_url($image_url); ?>" alt="<?php the_title(); ?>" />
                        </div>
                        <div class="ht-title-wrap">
                            <h6 class="member-name"><?php the_title(); ?></h6>

                            <div class="ht-team-member-excerpt-wrap">
                              <div class="ht-team-member-span">
                                 <?php //if (!empty($lz_fitness_team_designation)) { ?>
                                     <!-- <div class="ht-team-designation"><?php //echo esc_html($lz_fitness_team_designation); ?></div> -->
                                     <div class="ht-team-designation">
                                        <?php if (!empty($lz_fitness_team_designation)) { ?>
                                            <div class="ht-team-designation"><?php echo esc_html($lz_fitness_team_designation); ?></div>
                                            <?php
                                        }
                                        ?>
                                    </div>
                                    <!-- <div class="ht-team-detail"><?php // _e('Detail', 'total') ?></div> -->
                                </div>
                            </div>

                            <?php if ($lz_fitness_team_facebook || $lz_fitness_team_twitter || $lz_fitness_team_google_plus) { ?>
                                <div class="ht-team-social-id">
                                   <?php if ($lz_fitness_team_facebook) { ?>
                                      <a target="_blank" href="<?php echo esc_url($lz_fitness_team_facebook) ?>"><i class="fa fa-facebook"></i></a>
                                  <?php } ?>
                                  <?php if ($lz_fitness_team_twitter) { ?>
                                      <a target="_blank" href="<?php echo esc_url($lz_fitness_team_twitter) ?>"><i class="fa fa-twitter"></i></a>
                                  <?php } ?>
                                  <?php if ($lz_fitness_team_google_plus) { ?>
                                      <a target="_blank" href="<?php echo esc_url($lz_fitness_team_google_plus) ?>"><i class="fa fa-google-plus"></i></a>
                                  <?php } ?>
                                  <?php if ($lz_fitness_team_pintrest) { ?>
                                    <a target="_blank" href="<?php echo esc_url($lz_fitness_team_pintrest) ?>"><i class="fa fa-pinterest-p"></i></a>
                                <?php } ?>
                            </div>							
                        <?php } ?>
                    </div>
                </div>
            </div>
            <?php
        endwhile;
        $text = ob_get_contents();
        ob_clean();
    endif;
    wp_reset_postdata();
    return $text;
}


/**
 * Liting the team/trainer details 
 * @param : int $pageId default is null
 * @param : boolean $isCustomizer default is false, if set to true will get the data stored with customizer
 * @param : int $i default is null, it will used as a iteration for data with customizer, this will be used only if the $isCustomizer is set to true.
 * @return: Text $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 Parag Chaure <parag.radical@outlook.com>
 * */


/*gallery*/

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

    ob_start();

    $args = array('post_type' => 'lz_fitness_gallery');
    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }
    $args['posts_per_page'] = -1;
    $colCls = '';
    // if($isCustomizer == true){
    $cols = get_theme_mod('lz_fitness_gallery_npp_count', 2);  
    ++$cols;
    switch ($cols) {
        case 1:
                        $colCls = 'col-md-12 col-sm-12';
                        break;
                    case 2:
                        $colCls = 'col-md-6 col-sm-6';
                        break;
                    case 4:
                    case 7:
                    case 8:
                        $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();
            $lz_fitness_image = wp_get_attachment_image_src(get_post_thumbnail_id(),'medium_large' );
            if ($isCustomizer === true) {
                // $lz_fitness_gallery_designation = get_theme_mod('lz_fitness_gallery_designation' . $i);
                // $lz_fitness_gallery_facebook = get_theme_mod('lz_fitness_gallery_facebook' . $i);
                // $lz_fitness_gallery_twitter = get_theme_mod('lz_fitness_gallery_twitter' . $i);
                // $lz_fitness_gallery_google_plus = get_theme_mod('lz_fitness_gallery_google_plus' . $i);
                // $lz_fitness_gallery_pintrest = get_theme_mod('lz_fitness_gallery_pintrest' . $i);
            } else {
                // $lz_fitness_gallery_facebook = '';
                // $lz_fitness_gallery_twitter = '';
                // $lz_fitness_gallery_google_plus = '';
                // $lz_fitness_gallery_pintrest = '';
            }

            $post = get_post();
            //Social media urls
            // $galleryFacebook = get_post_meta($post->ID, 'galleryFacebook', false);
            // $lz_fitness_gallery_facebook = !empty($teamFacebook[0]) ? $galleryFacebook[0] : '';
            // $galleryTwitter = get_post_meta($post->ID, 'galleryTwitter', false);
            // $lz_fitness_gallery_twitter = !empty($teamTwitter[0]) ? $galleryTwitter[0] : '';
            // $galleryGPlus = get_post_meta($post->ID, 'galleryGPlus', false);
            // $lz_fitness_gallery_google_plus = !empty($teamGPlus[0]) ? $galleryGPlus[0] : '';
            // $galleryPintrest = get_post_meta($post->ID, 'galleryPintrest', false);
            // $lz_fitness_gallery_pintrest = !empty($galleryPintrest[0]) ? $galleryPintrest[0] : '';
            // //designation
            // $designation = get_post_meta($post->ID, 'designation', false);
            // $lz_fitness_gallery_designation = !empty($designation[0]) ? $designation[0] : '';

            
            ?>
            <div class="row">
            <div class="<?php echo $colCls; ?>  padding5">
                    <div class="ht-gallery-member-image">
                        <?php
                        if (has_post_thumbnail()) {
                            $image_url = $lz_fitness_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>
                    </div>
                    
                    <!--  <h6 class="member-name"><?php //the_title(); ?></h6> -->
                    
                    <!-- <div class="ht-gallery-member-excerpt-wrap"> -->
                       <!--   <div class="ht-gallery-member-span"> -->
                        <?php //if (!empty($lz_fitness_team_designation)) {// ?>
                            <!-- <div class="ht-team-designation"><?php //echo esc_html($lz_fitness_team_designation); ?></div> -->
                            <!--  <div class="ht-gallery-content">-->
                                <?php                                   
                                           // if(has_excerpt()){
                                               // echo get_the_excerpt();
                                            // }else{
                                               // echo lz_fitness_excerpt( get_the_content() , 100 );
                                            // } 
                                ?>
                                <!--  </div>  -->
                                <!-- <div class="ht-team-detail"><?php//_e('Detail', 'total') ?></div> -->
                                <!-- </div> --> 
                                <!--   </div> -->
                                
                                <!-- <?php// if ($lz_fitness_gallery_facebook || $lz_fitness_gallery_twitter || $lz_fitness_gallery_google_plus) { ?>
                                <div class="ht-team-social-id">
                                    <?php // if ($lz_fitness_gallery_facebook) { ?>
                                        <a target="_blank" href="<?php // echo esc_url($lz_fitness_gallery_facebook) ?>"><i class="fa fa-facebook"></i></a>
                                    <?php //} ?>
                                    <?php //if ($lz_fitness_gallery_twitter) { ?>
                                        <a target="_blank" href="<?php // echo esc_url($lz_fitness_gallery_twitter) ?>"><i class="fa fa-twitter"></i></a>
                                    <?php // } ?>
                                    <?php //if ($lz_fitness_gallery_google_plus) { ?>
                                        <a target="_blank" href="<?php // echo esc_url($lz_fitness_gallery_google_plus) ?>"><i class="fa fa-google-plus"></i></a>
                                    <?php //} ?>
                                    <?php // if ($lz_fitness_gallery_pintrest) { ?>
                                        <a target="_blank" href="<?php // echo esc_url($lz_fitness_gallery_pintrest) ?>"><i class="fa fa-pinterest-p"></i></a>
                                    <?php // } ?>
                                </div>                          
                                <?php// } ?> -->
                                
                        </div>
                        <?php
                    endwhile;
                    $text = ob_get_contents();
                    ob_clean();
                endif;
                wp_reset_postdata();
                return $text;
            }

 

            /**/

            function testimonialShortCode($pageId = null, $isCustomizer = false, $i = 0, $showStaticVals = false, $totalItems=0) {
                global $query;
                $args = array('post_type' => 'lz_fitness_testimoni');
                if (!empty($pageId)) {
                    $args['page_id'] = absint($pageId);
                } else {
                    $args['paged'] = max(1, get_query_var('paged'));
                }
                $args['posts_per_page'] = (!empty($args['posts_per_page'])) ? $args['posts_per_page'] : -1;
                $i = !empty($i) && is_numeric($i) ? $i : 0;
                $text = '';
                $query = new WP_Query($args);
    // print_r($query);
                if ($query->have_posts()):
                    $cssCls = ($isCustomizer == false) ? 'col-sm-4' : 'col-sm-10 col-sm-offset-1';

                    ob_start();
                    while ($query->have_posts()) : $query->the_post();
                        $post = get_post();
                        $lz_fitness_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'total-team-thumb');
           // echo"(($i == 0) || ($i%2)==0)".__LINE__;
                        if(($i == 0) || ($i%3)==0){
                            ?>
                            <div class="item <?php if ($i == 0) { ?>active<?php } ?>">
                                <div class="row">
                                    <?php
                                }
                                ?>

                                <div class="<?php echo $cssCls; ?> main-test-box">
                                    <?php if ($isCustomizer == false) { ?>
                                        <div class="row page-testimonial-box">
                                            
                                           <div class="col-sm-12 padding0">
                                           <?php } ?>
                                           
                                           <div class="col-sm-12 testimonial-content-box">
                                            <div class="testimonial-content">
                                             <p><?php
                                             if (has_excerpt()) {
                                                echo get_the_excerpt();
                                            } else {
                                                echo lz_fitness_excerpt(get_the_content(), 250);
                                            }
                                            ?>
                                        </p>
                                    </div>
                                    <div class="col-md-3 col-sm-3 test-img padding0">
                                        <img src="<?php echo (!empty($lz_fitness_image[0])) ? $lz_fitness_image[0] : get_template_directory_uri() . '/images/team-thumb.png' ?>" class="img-responsive" alt="<?php the_title(); ?>" />
                                    </div>
                                    <div class="col-md-9 col-sm-9 padding5">
                                        <h6 class="secondry-text"><?php the_title(); ?></h6>
                                        <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="team-thumb">
                                    <!-- <img src="<?php //echo (!empty($lz_fitness_image[0])) ? $lz_fitness_image[0] : get_template_directory_uri() . '/images/team-thumb.png' ?>" class="img-responsive" alt="<?php //the_title(); ?>" /> -->
                                <!-- <div class="blockquote">
                                   <i class="fa fa-quote-left"></i>
                               </div> -->
                           </div>
                           <!--  <h6 class="secondry-text"><?php //the_title(); ?></h6> -->
                           <!--<div class="text-designation">-->
                            <?php
                                    //$name2 = get_post_meta($post->ID, 'testimonial_Sub_Title', false);
                                    //echo (!empty($name2[0])) ? $name2[0] : '';
                            ?>
                            <!-- </div>-->
                            
                            
                            <?php if ($isCustomizer == false) { ?>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                    <?php } ?>
                </div>
                <?php
            //echo"\n($i+1)%2 == 0 || $totalItems == ($i+1)";
                if(($i+1)%3 == 0 || $totalItems == ($i+1)){ ?>
                </div>
            </div>
            <?php
        }
        ?>

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

/**
 * Use for the show the notes at home page and in notes 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 Dipika Ingle <dipika1.radical@outlook.com>
 * */
function projectShortCode($pageId = null, $isCustomizer = false, $i = null) {

    ob_start();

    $args = array('post_type' => 'project');
    if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
    }
    $args['posts_per_page'] = -1;
    $colCls = '';
    // if($isCustomizer == true){
    $cols = get_theme_mod('project_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 4:
        $colCls = 'col-md-3 col-sm-6 col-xs-12';
        break;       
        case 5:
        case 6:
        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();
            $lz_fitness_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'total-project-thumb');
            $post = get_post();

            if (($postN % 3) == 0 && $isCustomizer == false) {
                ?>
                <div class="clearfix paddingBot20"></div>
            </div>
            <div class="row">
                <?php
            }
            ++$postN;
            ?>
            
            <div class="<?php echo $colCls; ?>">
                <div class="ht-project-member paddingBot20">
                    <div class="ht-project-member-image">
                        <?php
                        if (has_post_thumbnail()) {
                            $image_url = $lz_fitness_image[0];
                        } else {
                            $image_url = get_template_directory_uri() . '/images/project.jpg';
                        }
                        ?>                                                          
                        <img class="secondry-bg img-responsive" src="<?php echo esc_url($image_url); ?>" alt="<?php the_title(); ?>" />

                    </div>
                    <div class="project-main-box">  
                        <div class="ht-title-Project">
                            <h6 class="member-name"><?php the_title(); ?></h6>                     
                            
                        </div>
                        <div class="ht-Project-contents">
                          <p><?php
                          if (has_excerpt()) {
                            echo get_the_excerpt();
                        } else {
                            echo lz_fitness_excerpt(get_the_content(), 100);
                        }
                        ?>
                    </p>
                    <div class="project-button">
                       <a class="btn " href="<?php echo esc_url(get_permalink()); ?>">VIEW PROJECT</a>
                   </div>
               </div>
           </div>
           
           
       </div>
   </div>
   <?php
endwhile;
$text = ob_get_contents();
ob_clean();
endif;
wp_reset_postdata();
return $text;
}


/**
 * Use for the show the gallery at home page and in the page where user add this the shortcode
 * @return void
 * @author Parag Chaure <parag.radical@outlook.com>
 * */

/**
 * 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 Parag Chaure <parag.radical@outlook.com>
 * */
function pricingShortcode() {
    ob_start();
    $cols = get_theme_mod('lz_fitness_pricing_npp_count', 2);
    $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:
        $colCls = 'col-md-4 col-sm-4';
        break;
        default:
        $colCls = 'col-md-3 col-sm-6';
        break;
    }
    echo '<div id="pricing-page">';
    $showStatic = true;
    for ($i = 1; $i <= $cols; $i++) {
        $PlanPageId = get_theme_mod('lz_fitness_pricing_plan_page_' . $i);
        $planTitle  = get_theme_mod('lz_fitness_pricing_plan_name_' . $i, 'Plan');
        $planPrice  = get_theme_mod('lz_fitness_pricing_plan_price_' . $i);
        $planContent= get_theme_mod('lz_fitness_pricing_plan_content_' . $i, '<ul><li>This is dummy text </li><li>This is dummy text </li><li>This is dummy text </li><li>This is dummy text </li><li>This is dummy text </li><li>This is dummy text </li></ul>');
        if ($PlanPageId || $planTitle || $planPrice || $planContent) {
            $showStatic = false;
            ?>
            <div class="<?php echo $colCls; ?>">
                <div class="ht-plan-block ">
                    <div class="ht-princing-icon"><?php echo esc_attr($planTitle); ?></div>
                    <div class="plan-amount"><sub>$</sub><?php echo esc_html($planPrice); ?></div>
                    <div class="ht-princing-excerpt">
                        <?php echo nl2br($planContent); ?>
                    </div>
                    <div class="ht-princing-link">
                        <a href="<?php echo esc_url(get_permalink($PlanPageId)); ?>"><?php _e('Join Now', 'gurukul'); ?></a>
                    </div>
                </div>
            </div>
            <?php
        }
    }
    if ($showStatic === true) {
        for ($i = 1; $i <= $cols; $i++) {
            ?>
            <div class="<?php echo $colCls; ?>">
                <div class="ht-plan-block">
                    <div class="ht-princing-icon">Plan</div>
                    <div class="plan-amount"><sub>$</sub>9.99</div>
                    <div class="ht-princing-excerpt">
                        <?php echo nl2br("<ul><li>This is dummy text </li><li>This is dummy text </li><li>This is dummy text </li><li>This is dummy text </li><li>This is dummy text </li><li>This is dummy text </li></ul>"); ?>
                    </div>
                    <div class="ht-princing-link">
                        <a href="#"><?php _e('Join Now', 'gurukul'); ?></a>
                    </div>
                </div>
            </div>
            <?php
        }
        echo '<div class="clearfix"></div>';
        echo '</div>';
    }

    $pricingHtml = ob_get_contents();
    // echo $pricingHtml;
    ob_flush();
    ob_clean();
}

/**
 * Use for the show the faq at home page and in page by using shortcode
 * @param int $isHome where the reference page is home page default is 0
 * @return void
 * @author Parag Chaure <parag.radical@outlook.com>
 * */
function faqShortcode($isHome = 0) {
    global $query;

    $args = array('post_type' => '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', 4);
        $cols++;
        $args['posts_per_page'] = $cols;
    }else{
        $args['posts_per_page'] = (!empty($args['posts_per_page'])) ? $args['posts_per_page'] : -1;

    }
    $faqPageId = get_theme_mod('faq_section_page_link');
    $query = new WP_Query($args);
    ob_start();
    // print_r($query);
    echo '<div class="faq">';
    if ($query->have_posts()){
        while ($query->have_posts()) : $query->the_post();
            $post = get_post();
            ?>
            <div class="row">
               <div class="col-md-12 faq-content padding0">
                <h6 class="faq-title"><?php the_title(); ?></h6>
                <div class="faq-description">
                    <p><?php
                    if(!empty($isHome) && $isHome==1){
                        if (has_excerpt()) {
                            echo get_the_excerpt();
                        } else {
                            echo lz_fitness_excerpt(get_the_content(), 100);
                        }
                        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="col-md-12 faq-content">
                <h6 class="faq-title">FAQ question </h6>
                <div class="faq-description">
                    <p><?php
                    if(!empty($isHome) && $isHome==1){
                        ?>
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean pharetra iaculis nunc sed pharetra. Sed faucibus non tellus laoreet finibus.
                        <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 dolor sit amet, consectetur adipiscing elit. Aenean pharetra iaculis nunc sed pharetra. Sed faucibus non tellus laoreet finibus. Cras enim erat, iaculis ac mauris a, faucibus maximus magna. Sed rhoncus quam id enim laoreet, vel vehicula purus consequat. Donec sed dapibus ipsum. Curabitur ultricies, massa sit amet aliquam laoreet, lorem nulla sagittis mauris, id porttitor arcu purus ut sem. Nunc aliquet nec velit sed consectetur. Aliquam aliquam diam varius, dictum libero in, lobortis tellus. Fusce eget tempus purus.

                        Vestibulum pretium gravida augue in semper. Cras eu lorem sed turpis venenatis ultricies quis eget diam. Integer porttitor sem sapien, id vestibulum justo ultricies et. Fusce in efficitur velit. Quisque risus quam, lobortis at neque nec, accumsan semper justo. Pellentesque in ligula dui. Donec vestibulum, ipsum non gravida elementum, magna diam faucibus magna, et interdum ante elit rutrum est. Suspendisse potenti. Quisque vehicula lacinia vulputate. Pellentesque a rhoncus dui, aliquam.
                        <?php
                    }?>
                </p>
            </div>  
        </div>
    </div>
    <?php
}
}
echo '</div>';
?>

<script>
    $(function(){
        $('.faq-description').hide();
        $('.faq-title').on('click', function(){
            $('.faq-description.active').slideToggle(600).removeClass('active');
            $(this).next().slideToggle(600).toggleClass('active');

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

