625 lines
25 KiB
PHP
625 lines
25 KiB
PHP
<?php
|
|
|
|
namespace THINKAIPLUGIN\Element;
|
|
|
|
use Elementor\Controls_Manager;
|
|
use Elementor\Controls_Stack;
|
|
use Elementor\Group_Control_Typography;
|
|
use Elementor\Group_Control_Border;
|
|
use Elementor\Repeater;
|
|
use Elementor\Widget_Base;
|
|
use Elementor\Utils;
|
|
use Elementor\Group_Control_Text_Shadow;
|
|
use \Elementor\Group_Control_Box_Shadow;
|
|
use \Elementor\Group_Control_Background;
|
|
use \Elementor\Group_Control_Image_Size;
|
|
use \Elementor\Group_Control_Text_Stroke;
|
|
use Elementor\Plugin;
|
|
|
|
/**
|
|
* Elementor button widget.
|
|
* Elementor widget that displays a button with the ability to control every
|
|
* aspect of the button design.
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
class Testimonial_Carousel extends Widget_Base
|
|
{
|
|
|
|
/**
|
|
* Get widget name.
|
|
* Retrieve button widget name.
|
|
*
|
|
* @since 1.0.0
|
|
* @access public
|
|
* @return string Widget name.
|
|
*/
|
|
public function get_name()
|
|
{
|
|
return 'thinkai_testimonial_carousel';
|
|
}
|
|
|
|
/**
|
|
* Get widget title.
|
|
* Retrieve button widget title.
|
|
*
|
|
* @since 1.0.0
|
|
* @access public
|
|
* @return string Widget title.
|
|
*/
|
|
public function get_title()
|
|
{
|
|
return esc_html__('Thinkai Testimonial Carousel', 'thinkai');
|
|
}
|
|
|
|
/**
|
|
* Get widget icon.
|
|
* Retrieve button widget icon.
|
|
*
|
|
* @since 1.0.0
|
|
* @access public
|
|
* @return string Widget icon.
|
|
*/
|
|
public function get_icon()
|
|
{
|
|
return 'eicon-testimonial-carousel';
|
|
}
|
|
|
|
/**
|
|
* Get widget categories.
|
|
* Retrieve the list of categories the button widget belongs to.
|
|
* Used to determine where to display the widget in the editor.
|
|
*
|
|
* @since 2.0.0
|
|
* @access public
|
|
* @return array Widget categories.
|
|
*/
|
|
public function get_categories()
|
|
{
|
|
return [ 'thinkai' ];
|
|
}
|
|
|
|
public function get_script_depends() {
|
|
wp_register_script( 'testimonial-script', YT_URL . 'assets/js/feature-carousel.js', [ 'elementor-frontend' ], '1.0.0', true );
|
|
return [ 'testimonial-script' ];
|
|
}
|
|
|
|
/**
|
|
* Register button widget controls.
|
|
* Adds different input fields to allow the user to change and customize the widget settings.
|
|
*
|
|
* @since 1.0.0
|
|
* @access protected
|
|
*/
|
|
protected function register_controls()
|
|
{
|
|
$this->start_controls_section(
|
|
'testimonials_carousel',
|
|
[
|
|
'label' => esc_html__('Thinkai Testimonials Carousel', 'thinkai'),
|
|
]
|
|
);
|
|
|
|
//Layout
|
|
$this->add_control(
|
|
'layout_control',
|
|
[
|
|
'label' => esc_html__( 'Layout Style', 'thinkai' ),
|
|
'label_block' => true,
|
|
'type' => Controls_Manager::SELECT,
|
|
'default' => '1',
|
|
'options' => array(
|
|
'1' => esc_html__( 'Style One ', 'thinkai'),
|
|
'2' => esc_html__( 'Style Two ', 'thinkai'),
|
|
'3' => esc_html__( 'Style Three ', 'thinkai'),
|
|
'4' => esc_html__( 'Style Four ', 'thinkai'),
|
|
),
|
|
]
|
|
);
|
|
|
|
$this->add_control(
|
|
'total_ratting',
|
|
[
|
|
'label' => __( 'Total Ratting', 'thinkai' ),
|
|
'type' => Controls_Manager::TEXT,
|
|
'label_block' => true,
|
|
'dynamic' => [
|
|
'active' => true,
|
|
],
|
|
'default' => esc_html__( '4.9/5.0', 'thinkai' ),
|
|
'condition' => [
|
|
'layout_control' => '1'
|
|
]
|
|
]
|
|
);
|
|
$this->add_control(
|
|
'ratting_description',
|
|
[
|
|
'label' => __( 'Ratting Description', 'thinkai' ),
|
|
'type' => Controls_Manager::TEXT,
|
|
'label_block' => true,
|
|
'dynamic' => [
|
|
'active' => true,
|
|
],
|
|
'default' => esc_html__( '(from 20k reviews)', 'thinkai' ),
|
|
'condition' => [
|
|
'layout_control' => '1'
|
|
]
|
|
]
|
|
);
|
|
$this->add_control(
|
|
'text_limit',
|
|
[
|
|
'label' => esc_html__('Text Limit', 'thinkai'),
|
|
'type' => Controls_Manager::NUMBER,
|
|
'default' => 3,
|
|
'min' => 1,
|
|
'max' => 100,
|
|
'step' => 1,
|
|
]
|
|
);
|
|
$this->add_control(
|
|
'query_number',
|
|
[
|
|
'label' => esc_html__('Number of post', 'thinkai'),
|
|
'type' => Controls_Manager::NUMBER,
|
|
'default' => 3,
|
|
'min' => 1,
|
|
'max' => 100,
|
|
'step' => 1,
|
|
]
|
|
);
|
|
$this->add_control(
|
|
'query_orderby',
|
|
[
|
|
'label' => esc_html__('Order By', 'thinkai'),
|
|
'type' => Controls_Manager::SELECT,
|
|
'default' => 'date',
|
|
'options' => array(
|
|
'date' => esc_html__('Date', 'thinkai'),
|
|
|
|
'title' => esc_html__('Title', 'thinkai'),
|
|
'menu_order' => esc_html__('Menu Order', 'thinkai'),
|
|
'rand' => esc_html__('Random', 'thinkai'),
|
|
),
|
|
]
|
|
);
|
|
$this->add_control(
|
|
'query_order',
|
|
[
|
|
'label' => esc_html__('Order', 'thinkai'),
|
|
'label_block' => true,
|
|
'type' => Controls_Manager::SELECT,
|
|
'default' => 'DESC',
|
|
'options' => array(
|
|
'DESC' => esc_html__('DESC', 'thinkai'),
|
|
'ASC' => esc_html__('ASC', 'thinkai'),
|
|
),
|
|
]
|
|
);
|
|
$this->add_control(
|
|
'query_category',
|
|
[
|
|
'type' => Controls_Manager::SELECT2,
|
|
'label' => esc_html__('Category', 'thinkai'),
|
|
'label_block' => true,
|
|
'multiple' => true,
|
|
'options' => get_testimonials_categories()
|
|
]
|
|
);
|
|
$this->end_controls_section();
|
|
|
|
|
|
//Next Prev Color Style
|
|
$this->start_controls_section(
|
|
'next_prev_color_style',
|
|
[
|
|
'label' => esc_html__( 'Next Prev Settings', 'thinkai' ),
|
|
'tab' => Controls_Manager::TAB_STYLE,
|
|
]
|
|
);
|
|
$this->add_control(
|
|
'next_prev_color',
|
|
[
|
|
'label' => esc_html__( 'Text Color', 'thinkai' ),
|
|
'type' => Controls_Manager::COLOR,
|
|
'selectors' => [
|
|
'{{WRAPPER}} .testimonial-style3__items-nav .swiper-button-next' => 'color: {{VALUE}} !important;',
|
|
'{{WRAPPER}} .testimonial-style3__items-nav .swiper-button-prev' => 'color: {{VALUE}} !important;',
|
|
],
|
|
]
|
|
);
|
|
$this->end_controls_section();
|
|
}
|
|
|
|
/**
|
|
* Render button widget output on the frontend.
|
|
* Written in PHP and used to generate the final HTML.
|
|
*
|
|
* @since 1.0.0
|
|
* @access protected
|
|
*/
|
|
protected function render()
|
|
{
|
|
$settings = $this->get_settings_for_display();
|
|
$allowed_tags = wp_kses_allowed_html('post');
|
|
$layout = $settings['layout_control'];
|
|
|
|
$paged = thinkai_set($_POST, 'paged') ? esc_attr($_POST['paged']) : 1;
|
|
|
|
$this->add_render_attribute('wrapper', 'class', 'templatepath-thinkai');
|
|
$args = array(
|
|
'post_type' => 'testimonials',
|
|
'posts_per_page' => thinkai_set($settings, 'query_number'),
|
|
'orderby' => thinkai_set($settings, 'query_orderby'),
|
|
'order' => thinkai_set($settings, 'query_order'),
|
|
'paged' => $paged
|
|
);
|
|
|
|
if (thinkai_set($settings, 'query_category')) {$args['testimonials_cat'] = thinkai_set($settings, 'query_category');
|
|
}$query = new \WP_Query($args);
|
|
|
|
if ($query->have_posts()) {
|
|
?>
|
|
|
|
<?php if($layout == '4') :?>
|
|
|
|
<!--Start Testimonial Style5-->
|
|
<section class="testimonial-style5 p-0 m-0">
|
|
<div class="container">
|
|
|
|
<div class="row">
|
|
<div class="col-xl-12">
|
|
<div class="testimonial-style5__inner">
|
|
<div class="owl-carousel owl-theme thm-owl__carousel testimonial-style5-carousel owl-nav-style-one"
|
|
data-owl-options='{
|
|
"loop": true,
|
|
"autoplay": false,
|
|
"margin": 30,
|
|
"nav": true,
|
|
"dots": false,
|
|
"smartSpeed": 500,
|
|
"autoplayTimeout": 10000,
|
|
"navText": ["<span class=\"left icon-left-arrow\"></span>","<span class=\"right icon-right-arrow\"></span>"],
|
|
"responsive": {
|
|
"0": {
|
|
"items": 1
|
|
},
|
|
"768": {
|
|
"items": 1
|
|
},
|
|
"992": {
|
|
"items": 2
|
|
},
|
|
"1200": {
|
|
"items": 3
|
|
}
|
|
}
|
|
}'>
|
|
<?php while ($query->have_posts()) : $query->the_post(); ?>
|
|
<!--Start Single Testimonial Style5-->
|
|
<div class="testimonial-style5__single">
|
|
<div class="overlay-icon">
|
|
<span class="icon-straight-quotes"></span>
|
|
</div>
|
|
<div class="review-box">
|
|
<ul>
|
|
<?php
|
|
$ratting = get_post_meta( get_the_id(), 'testimonial_rating', true );
|
|
for ($x = 1; $x <= 5; $x++) {
|
|
if($x <= $ratting) echo '<li><span class="fa fa-star"></span></li>'; else echo '<li><span class="fa fa-star-half-alt"></span></li>';
|
|
}
|
|
?>
|
|
</ul>
|
|
</div>
|
|
<div class="testimonial-style5__single-title">
|
|
<h3><a href="<?php echo (get_post_meta(get_the_id(), 'te_ext_link', true)); ?>"><?php the_title(); ?></a></h3>
|
|
</div>
|
|
<div class="testimonial-style5__single-video">
|
|
<a class="video-popup" title="Video Gallery"
|
|
href="<?php echo (get_post_meta(get_the_id(), 'te_video_url', true)); ?>">
|
|
<span class="icon-play-button-arrowhead"></span>
|
|
<?php echo (get_post_meta(get_the_id(), 'te_video_title', true)); ?>
|
|
</a>
|
|
</div>
|
|
<div class="testimonial-style5__single-author-info">
|
|
<?php if(has_post_thumbnail()){ ?>
|
|
<div class="img-box">
|
|
<?php the_post_thumbnail('thinkai_70x70'); ?>
|
|
</div>
|
|
<?php } ?>
|
|
<div class="title-box">
|
|
<h3><?php echo(get_post_meta(get_the_id(), 'author_name', true)); ?></h3>
|
|
<p><?php echo(get_post_meta(get_the_id(), 'author_designation', true)); ?></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!--End Single Testimonial Style5-->
|
|
<?php endwhile; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</section>
|
|
<!--End Testimonial Style5-->
|
|
|
|
<?php elseif($layout == '3') :?>
|
|
|
|
<!--Start Testimonial Style3-->
|
|
<section class="testimonial-style3 p-0 m-0">
|
|
<div class="container">
|
|
|
|
<div class="testimonial-style3__inner">
|
|
<div class="thm-swiper__slider swiper-container" data-swiper-options='{
|
|
"spaceBetween": 0,
|
|
"speed": 1500,
|
|
"slidesPerView": 1,
|
|
"loop": true,
|
|
"pagination": {
|
|
"el": "#testimonial-style3__items-nav",
|
|
"type": "bullets",
|
|
"clickable": true
|
|
},
|
|
"navigation": {
|
|
"nextEl": "#testimonial-style3__items-nav__prev",
|
|
"prevEl": "#testimonial-style3__items-nav__next"
|
|
},
|
|
"autoplay": { "delay": 5000 },
|
|
"breakpoints": {
|
|
"0": {
|
|
"spaceBetween": 0,
|
|
"slidesPerView": 1
|
|
},
|
|
"375": {
|
|
"spaceBetween": 0,
|
|
"slidesPerView": 1
|
|
},
|
|
"575": {
|
|
"spaceBetween": 0,
|
|
"slidesPerView": 1
|
|
},
|
|
"768": {
|
|
"spaceBetween": 0,
|
|
"slidesPerView": 1
|
|
},
|
|
"992": {
|
|
"spaceBetween": 0,
|
|
"slidesPerView": 1
|
|
},
|
|
"1200": {
|
|
"spaceBetween": 0,
|
|
"slidesPerView": 1
|
|
}
|
|
}
|
|
}'>
|
|
|
|
<div class="swiper-wrapper">
|
|
<?php while ($query->have_posts()) : $query->the_post(); ?>
|
|
<!--Start Testimonial Style3 Single-->
|
|
<div class="swiper-slide">
|
|
<div class="testimonial-style3__single">
|
|
<div class="testimonial-style3__single-content-box text-center">
|
|
<div class="title">
|
|
<div class="icon-box">
|
|
<img src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/icon/tastimonial-style-3__icon-happy.png" alt="<?php bloginfo( 'name' ); ?>">
|
|
</div>
|
|
<h3><?php the_title(); ?></h3>
|
|
</div>
|
|
<div class="rating-box">
|
|
<ul>
|
|
<?php
|
|
$ratting = get_post_meta( get_the_id(), 'testimonial_rating', true );
|
|
for ($x = 1; $x <= 5; $x++) {
|
|
if($x <= $ratting) echo '<li><span class="fa fa-star"></span></li>'; else echo '<li><span class="fa fa-star-half-alt"></span></li>';
|
|
}
|
|
?>
|
|
</ul>
|
|
</div>
|
|
<div class="text">
|
|
<p><?php echo wp_kses(wp_trim_words(get_the_content(), $settings['text_limit']), true); ?></p>
|
|
</div>
|
|
</div>
|
|
<div class="customer-info">
|
|
<div class="img-box">
|
|
<?php the_post_thumbnail('thinkai_70x70'); ?>
|
|
</div>
|
|
<div class="title-box">
|
|
<h3><?php echo(get_post_meta(get_the_id(), 'author_name', true)); ?></h3>
|
|
<span><?php echo(get_post_meta(get_the_id(), 'author_designation', true)); ?></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!--End Testimonial Style3 Single-->
|
|
<?php endwhile; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<!--End Testimonial Style3 Items -->
|
|
|
|
<div class="testimonial-style3__items-nav">
|
|
<div class="swiper-button-prev" id="testimonial-style3__items-nav__prev">
|
|
<i class="icon-left-arrow1 left"></i> <?php esc_html_e('Prev','thinkai'); ?>
|
|
</div>
|
|
<div class="swiper-button-next" id="testimonial-style3__items-nav__next">
|
|
<?php esc_html_e('Next','thinkai'); ?> <i class="icon-right-arrow1 right"></i>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<!--End Testimonial Style3-->
|
|
|
|
<?php elseif($layout == '2') :?>
|
|
|
|
<!--Start Testimonials Style2 -->
|
|
<section class="testimonials-style2 p-0 m-0">
|
|
|
|
<div class="testimonials-style2__inner">
|
|
<div class="owl-carousel owl-theme thm-owl__carousel testimonials-style2__carousel"
|
|
data-owl-options='{
|
|
"loop": true,
|
|
"autoplay": false,
|
|
"margin": 30,
|
|
"nav": false,
|
|
"dots": false,
|
|
"smartSpeed": 500,
|
|
"autoplayTimeout": 10000,
|
|
"navText": ["<span class=\"left icon-right-arrow-4\"></span>","<span class=\"right icon-right-arrow-4\"></span>"],
|
|
"responsive": {
|
|
"0": {
|
|
"items": 1
|
|
},
|
|
"768": {
|
|
"items": 1
|
|
},
|
|
"992": {
|
|
"items": 2
|
|
},
|
|
"1200": {
|
|
"items": 3
|
|
}
|
|
}
|
|
}'>
|
|
<?php while ($query->have_posts()) : $query->the_post(); ?>
|
|
<!--Start Testimonials Style2 Single-->
|
|
<div class="testimonials-style2__single">
|
|
<div class="icon-box">
|
|
<span class="icon-quote"></span>
|
|
</div>
|
|
<div class="title-box">
|
|
<h3><?php the_title(); ?></h3>
|
|
<p><?php echo(get_post_meta(get_the_id(), 'author_designation', true)); ?></p>
|
|
</div>
|
|
<div class="text-box">
|
|
<p><?php echo wp_kses(wp_trim_words(get_the_content(), $settings['text_limit']), true); ?></p>
|
|
</div>
|
|
<div class="review-box">
|
|
<ul>
|
|
<?php
|
|
$ratting = get_post_meta( get_the_id(), 'testimonial_rating', true );
|
|
for ($x = 1; $x <= 5; $x++) {
|
|
if($x <= $ratting) echo '<li><i class="fa fa-star"></i></li>'; else echo '<li><i class="fa fa-star-half-alt"></i></li>';
|
|
}
|
|
?>
|
|
</ul>
|
|
</div>
|
|
<div class="author-info-box">
|
|
<div class="img-box">
|
|
<?php the_post_thumbnail('thinkai_70x70'); ?>
|
|
</div>
|
|
<div class="date-box">
|
|
<h4><?php echo(get_post_meta(get_the_id(), 'review_title', true)); ?></h4>
|
|
<p><?php echo(get_post_meta(get_the_id(), 'review_time', true)); ?></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!--End Testimonials Style2 Single-->
|
|
<?php endwhile; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<!--End Testimonials Style2 -->
|
|
|
|
<?php else: ?>
|
|
|
|
<!--Start Testimonial Style1-->
|
|
<section class="testimonial-style1 p-0 m-0">
|
|
<div class="container">
|
|
|
|
<div class="testimonial-style1__inner">
|
|
<div class="testimonial-style1__middle-content">
|
|
<div class="icon">
|
|
<div class="clearfix bshadow0 pbs">
|
|
<span class="icon-google"><span class="path1"></span><span class="path2"></span><span class="path3"></span><span class="path4"></span><span class="path5"></span><span class="path6"></span></span>
|
|
</div>
|
|
</div>
|
|
<div class="review-box">
|
|
<ul>
|
|
<li>
|
|
<i class="icon-rate-star-button"></i>
|
|
</li>
|
|
<li>
|
|
<i class="icon-rate-star-button"></i>
|
|
</li>
|
|
<li>
|
|
<i class="icon-rate-star-button"></i>
|
|
</li>
|
|
<li>
|
|
<i class="icon-rate-star-button"></i>
|
|
</li>
|
|
<li>
|
|
<i class="icon-rate-star-button"></i>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="text-box">
|
|
<h3><?php echo wp_kses($settings['total_ratting'], true); ?></h3>
|
|
<p><?php echo wp_kses($settings['ratting_description'], true); ?></p>
|
|
</div>
|
|
</div>
|
|
<div class="owl-carousel owl-theme thm-owl__carousel testimonial-style1__carousel" data-owl-options='{
|
|
"loop": true,
|
|
"autoplay": false,
|
|
"margin": 430,
|
|
"nav": false,
|
|
"dots": false,
|
|
"smartSpeed": 500,
|
|
"autoplayTimeout": 10000,
|
|
"navText": ["<span class=\"left icon-right-arrow-4\"></span>","<span class=\"right icon-right-arrow-4\"></span>"],
|
|
"responsive": {
|
|
"0": {
|
|
"items": 1
|
|
},
|
|
"768": {
|
|
"items": 1
|
|
},
|
|
"992": {
|
|
"items": 2
|
|
},
|
|
"1200": {
|
|
"items": 2
|
|
}
|
|
}
|
|
}'>
|
|
<?php while ($query->have_posts()) : $query->the_post(); ?>
|
|
<!--Start Testimonial Style1 Single-->
|
|
<div class="testimonial-style1__single">
|
|
<div class="icon-box">
|
|
<span class="icon-quote-1"></span>
|
|
</div>
|
|
<div class="text">
|
|
<p><?php echo wp_kses(wp_trim_words(get_the_content(), $settings['text_limit']), true); ?></p>
|
|
</div>
|
|
<div class="author-info">
|
|
<h2><?php the_title(); ?></h2>
|
|
<p><?php echo(get_post_meta(get_the_id(), 'author_designation', true)); ?></p>
|
|
</div>
|
|
<div class="testimonial-style1__single-bottom">
|
|
<div class="img-box">
|
|
<?php the_post_thumbnail('thinkai_70x70'); ?>
|
|
</div>
|
|
<div class="date-box">
|
|
<h4><?php echo(get_post_meta(get_the_id(), 'review_title', true)); ?></h4>
|
|
<p><?php echo(get_post_meta(get_the_id(), 'review_time', true)); ?></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!--End Testimonial Style1 Single-->
|
|
<?php endwhile; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<!--End Testimonial Style1-->
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php }
|
|
wp_reset_postdata();
|
|
}
|
|
}
|