true, ], 'objects'); $options = []; foreach ($post_types as $post_type) { // Exclude Elementor specific post types if (in_array($post_type->name, ['elementor_library', 'attachment'])) { continue; } $options[$post_type->name] = $post_type->label; } return $options; } protected function _register_controls() { $this->start_controls_section( 'content_section', [ 'label' => esc_html__('Testimonials', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'data_source', [ 'label' => esc_html__('Data Source', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'custom', 'options' => [ 'custom' => esc_html__('Custom Entry', 'advanced-widget-kit-for-elementor'), 'dynamic' => esc_html__('Selected Post Type', 'advanced-widget-kit-for-elementor'), ], ] ); $this->add_control( 'design_style', [ 'label' => esc_html__('Design Style', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'classic', 'options' => [ 'classic' => esc_html__('Classic', 'advanced-widget-kit-for-elementor'), 'card' => esc_html__('Card Style', 'advanced-widget-kit-for-elementor'), 'bubble' => esc_html__('Bubble Style', 'advanced-widget-kit-for-elementor'), 'minimal' => esc_html__('Minimal', 'advanced-widget-kit-for-elementor'), 'image-left' => esc_html__('Image Left', 'advanced-widget-kit-for-elementor'), 'image-top' => esc_html__('Image Top', 'advanced-widget-kit-for-elementor'), ], ] ); // Design-specific controls for Card $this->add_control( 'card_image_position', [ 'label' => esc_html__('Image Position', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__('Left', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-h-align-left', ], 'right' => [ 'title' => esc_html__('Right', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-h-align-right', ], ], 'default' => 'left', 'condition' => [ 'design_style' => 'card', ], ] ); $this->add_control( 'card_border_side', [ 'label' => esc_html__('Border Accent Side', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => [ 'left' => esc_html__('Left', 'advanced-widget-kit-for-elementor'), 'right' => esc_html__('Right', 'advanced-widget-kit-for-elementor'), 'top' => esc_html__('Top', 'advanced-widget-kit-for-elementor'), 'bottom' => esc_html__('Bottom', 'advanced-widget-kit-for-elementor'), ], 'default' => 'left', 'condition' => [ 'design_style' => 'card', ], ] ); // Design-specific controls for Bubble $this->add_control( 'bubble_tail_position', [ 'label' => esc_html__('Bubble Tail Position', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => [ 'center' => esc_html__('Center', 'advanced-widget-kit-for-elementor'), 'left' => esc_html__('Left', 'advanced-widget-kit-for-elementor'), 'right' => esc_html__('Right', 'advanced-widget-kit-for-elementor'), ], 'default' => 'center', 'condition' => [ 'design_style' => 'bubble', ], ] ); // Design-specific controls for Image Left/Right $this->add_control( 'image_side_position', [ 'label' => esc_html__('Image Side', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__('Left', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-h-align-left', ], 'right' => [ 'title' => esc_html__('Right', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-h-align-right', ], ], 'default' => 'left', 'condition' => [ 'design_style' => 'image-left', ], ] ); // Design-specific controls for Image Top $this->add_responsive_control( 'image_top_size', [ 'label' => esc_html__('Image Size', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 60, 'max' => 150, ], ], 'default' => [ 'size' => 100, ], 'selectors' => [ '{{WRAPPER}} .awke-design-image-top .awke-client-image img' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'design_style' => 'image-top', ], ] ); // General alignment control (for applicable designs) $this->add_responsive_control( 'design_alignment', [ 'label' => esc_html__('Content Alignment', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__('Left', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => esc_html__('Center', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => esc_html__('Right', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-text-align-right', ], ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .awke-testimonial-widget' => 'text-align: {{VALUE}};', ], 'condition' => [ 'design_style' => ['classic', 'bubble', 'minimal'], ], ] ); $this->add_control( 'testimonial_style', [ 'label' => esc_html__('Style', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'single', 'options' => [ 'single' => esc_html__('Single Testimonial', 'advanced-widget-kit-for-elementor'), 'carousel' => esc_html__('Carousel Slider', 'advanced-widget-kit-for-elementor'), ], 'condition' => [ 'data_source' => 'custom', ], ] ); // Single testimonial controls $this->add_control( 'testimonial_content', [ 'label' => esc_html__('Testimonial Content', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::TEXTAREA, 'default' => esc_html__('This is a great product! I highly recommend it to everyone.', 'advanced-widget-kit-for-elementor'), 'placeholder' => esc_html__('Enter testimonial content', 'advanced-widget-kit-for-elementor'), 'dynamic' => ['active' => true], 'condition' => [ 'testimonial_style' => 'single', ], ] ); $this->add_control( 'client_name', [ 'label' => esc_html__('Client Name', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => esc_html__('John Doe', 'advanced-widget-kit-for-elementor'), 'dynamic' => ['active' => true], 'condition' => [ 'testimonial_style' => 'single', ], ] ); $this->add_control( 'client_title', [ 'label' => esc_html__('Client Title', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => esc_html__('CEO, Company Name', 'advanced-widget-kit-for-elementor'), 'dynamic' => ['active' => true], 'condition' => [ 'testimonial_style' => 'single', ], ] ); $this->add_control( 'client_image', [ 'label' => esc_html__('Client Photo', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::MEDIA, 'default' => [ 'url' => \Elementor\Utils::get_placeholder_image_src(), ], 'dynamic' => ['active' => true], 'condition' => [ 'testimonial_style' => 'single', ], ] ); $this->add_control( 'rating', [ 'label' => esc_html__('Rating', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::NUMBER, 'min' => 0, 'max' => 5, 'step' => 0.1, 'default' => 5, 'condition' => [ 'testimonial_style' => 'single', ], ] ); // Multiple testimonials for carousel $repeater = new \Elementor\Repeater(); $repeater->add_control( 'testimonial_content', [ 'label' => esc_html__('Testimonial Content', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::TEXTAREA, 'default' => esc_html__('This is a great product! I highly recommend it to everyone.', 'advanced-widget-kit-for-elementor'), 'placeholder' => esc_html__('Enter testimonial content', 'advanced-widget-kit-for-elementor'), ] ); $repeater->add_control( 'client_name', [ 'label' => esc_html__('Client Name', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => esc_html__('John Doe', 'advanced-widget-kit-for-elementor'), ] ); $repeater->add_control( 'client_title', [ 'label' => esc_html__('Client Title', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => esc_html__('CEO, Company Name', 'advanced-widget-kit-for-elementor'), ] ); $repeater->add_control( 'client_image', [ 'label' => esc_html__('Client Photo', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::MEDIA, 'default' => [ 'url' => \Elementor\Utils::get_placeholder_image_src(), ], ] ); $repeater->add_control( 'rating', [ 'label' => esc_html__('Rating', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::NUMBER, 'min' => 0, 'max' => 5, 'step' => 0.1, 'default' => 5, ] ); $this->add_control( 'testimonials', [ 'label' => esc_html__('Testimonials', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::REPEATER, 'fields' => $repeater->get_controls(), 'default' => [ [ 'testimonial_content' => esc_html__('This is a great product! I highly recommend it to everyone.', 'advanced-widget-kit-for-elementor'), 'client_name' => esc_html__('John Doe', 'advanced-widget-kit-for-elementor'), 'client_title' => esc_html__('CEO, Company Name', 'advanced-widget-kit-for-elementor'), 'rating' => 5, ], [ 'testimonial_content' => esc_html__('Amazing service and support. Will definitely use again!', 'advanced-widget-kit-for-elementor'), 'client_name' => esc_html__('Jane Smith', 'advanced-widget-kit-for-elementor'), 'client_title' => esc_html__('Marketing Director', 'advanced-widget-kit-for-elementor'), 'rating' => 5, ], [ 'testimonial_content' => esc_html__('Professional, reliable, and delivers great results every time.', 'advanced-widget-kit-for-elementor'), 'client_name' => esc_html__('Mike Johnson', 'advanced-widget-kit-for-elementor'), 'client_title' => esc_html__('Freelancer', 'advanced-widget-kit-for-elementor'), 'rating' => 4.5, ], ], 'title_field' => '{{{ client_name }}}', 'condition' => [ 'testimonial_style' => 'carousel', 'data_source' => 'custom', ], ] ); $this->end_controls_section(); // Dynamic Query Section $this->start_controls_section( 'query_section', [ 'label' => esc_html__('Query', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, 'condition' => [ 'data_source' => 'dynamic', ], ] ); $this->add_control( 'post_type', [ 'label' => esc_html__('Post Type', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'post', 'options' => $this->get_post_types(), ] ); $this->add_control( 'posts_per_page', [ 'label' => esc_html__('Number of Items', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::NUMBER, 'default' => 6, 'min' => 1, 'max' => 50, 'description' => esc_html__('Total number of testimonials to load. Should be more than "Slides to Show" for carousel to work.', 'advanced-widget-kit-for-elementor'), ] ); $this->add_control( 'order_by', [ 'label' => esc_html__('Order By', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'date', 'options' => [ 'date' => esc_html__('Date', 'advanced-widget-kit-for-elementor'), 'title' => esc_html__('Title', 'advanced-widget-kit-for-elementor'), 'rand' => esc_html__('Random', 'advanced-widget-kit-for-elementor'), 'menu_order' => esc_html__('Menu Order', 'advanced-widget-kit-for-elementor'), ], ] ); $this->add_control( 'order', [ 'label' => esc_html__('Order', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'DESC', 'options' => [ 'ASC' => esc_html__('Ascending', 'advanced-widget-kit-for-elementor'), 'DESC' => esc_html__('Descending', 'advanced-widget-kit-for-elementor'), ], ] ); $this->end_controls_section(); // Field Mapping Section $this->start_controls_section( 'field_mapping_section', [ 'label' => esc_html__('Field Mapping', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, 'condition' => [ 'data_source' => 'dynamic', ], ] ); $this->add_control( 'content_source', [ 'label' => esc_html__('Content Source', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'content', 'options' => [ 'content' => esc_html__('Post Content', 'advanced-widget-kit-for-elementor'), 'excerpt' => esc_html__('Post Excerpt', 'advanced-widget-kit-for-elementor'), 'custom_field' => esc_html__('Custom Field', 'advanced-widget-kit-for-elementor'), ], ] ); $this->add_control( 'content_custom_field', [ 'label' => esc_html__('Content Custom Field Name', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::TEXT, 'placeholder' => esc_html__('testimonial_text', 'advanced-widget-kit-for-elementor'), 'condition' => [ 'content_source' => 'custom_field', ], ] ); $this->add_control( 'name_source', [ 'label' => esc_html__('Name Source', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'title', 'options' => [ 'title' => esc_html__('Post Title', 'advanced-widget-kit-for-elementor'), 'author' => esc_html__('Post Author', 'advanced-widget-kit-for-elementor'), 'custom_field' => esc_html__('Custom Field', 'advanced-widget-kit-for-elementor'), ], ] ); $this->add_control( 'name_custom_field', [ 'label' => esc_html__('Name Custom Field Name', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::TEXT, 'placeholder' => esc_html__('client_name', 'advanced-widget-kit-for-elementor'), 'condition' => [ 'name_source' => 'custom_field', ], ] ); $this->add_control( 'title_source', [ 'label' => esc_html__('Title/Position Source', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'custom_field', 'options' => [ 'custom_field' => esc_html__('Custom Field', 'advanced-widget-kit-for-elementor'), 'category' => esc_html__('First Category', 'advanced-widget-kit-for-elementor'), 'none' => esc_html__('None', 'advanced-widget-kit-for-elementor'), ], ] ); $this->add_control( 'title_custom_field', [ 'label' => esc_html__('Title Custom Field Name', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::TEXT, 'placeholder' => esc_html__('client_position', 'advanced-widget-kit-for-elementor'), 'default' => 'client_position', 'condition' => [ 'title_source' => 'custom_field', ], ] ); $this->add_control( 'image_source', [ 'label' => esc_html__('Image Source', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'featured', 'options' => [ 'featured' => esc_html__('Featured Image', 'advanced-widget-kit-for-elementor'), 'custom_field' => esc_html__('Custom Field', 'advanced-widget-kit-for-elementor'), 'author_avatar' => esc_html__('Author Avatar', 'advanced-widget-kit-for-elementor'), ], ] ); $this->add_control( 'image_custom_field', [ 'label' => esc_html__('Image Custom Field Name', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::TEXT, 'placeholder' => esc_html__('client_photo', 'advanced-widget-kit-for-elementor'), 'condition' => [ 'image_source' => 'custom_field', ], ] ); $this->add_control( 'rating_source', [ 'label' => esc_html__('Rating Source', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'custom_field', 'options' => [ 'custom_field' => esc_html__('Custom Field', 'advanced-widget-kit-for-elementor'), 'fixed' => esc_html__('Fixed Value', 'advanced-widget-kit-for-elementor'), 'none' => esc_html__('None', 'advanced-widget-kit-for-elementor'), ], ] ); $this->add_control( 'rating_custom_field', [ 'label' => esc_html__('Rating Custom Field Name', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::TEXT, 'placeholder' => esc_html__('rating', 'advanced-widget-kit-for-elementor'), 'default' => 'rating', 'condition' => [ 'rating_source' => 'custom_field', ], ] ); $this->add_control( 'rating_fixed_value', [ 'label' => esc_html__('Fixed Rating Value', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::NUMBER, 'min' => 0, 'max' => 5, 'step' => 0.5, 'default' => 5, 'condition' => [ 'rating_source' => 'fixed', ], ] ); $this->add_control( 'max_stars', [ 'label' => esc_html__('Maximum Stars', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::NUMBER, 'min' => 1, 'max' => 20, 'step' => 1, 'default' => 5, 'description' => esc_html__('Maximum number of stars to display (e.g., 5, 10, 20)', 'advanced-widget-kit-for-elementor'), ] ); $this->end_controls_section(); // Carousel Settings $this->start_controls_section( 'carousel_section', [ 'label' => esc_html__('Carousel Settings', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'relation' => 'and', 'terms' => [ [ 'name' => 'data_source', 'operator' => '===', 'value' => 'custom', ], [ 'name' => 'testimonial_style', 'operator' => '===', 'value' => 'carousel', ], ], ], [ 'name' => 'data_source', 'operator' => '===', 'value' => 'dynamic', ], ], ], ] ); $this->add_control( 'slides_to_show', [ 'label' => esc_html__('Slides to Show', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => '1', 'options' => [ '1' => '1', '2' => '2', '3' => '3', ], 'description' => esc_html__('How many testimonials to display at once. Should be less than "Number of Items" for navigation to work.', 'advanced-widget-kit-for-elementor'), 'frontend_available' => true, ] ); $this->add_control( 'autoplay', [ 'label' => esc_html__('Autoplay', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'autoplay_speed', [ 'label' => esc_html__('Autoplay Speed', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::NUMBER, 'default' => 3000, 'condition' => [ 'autoplay' => 'yes', ], 'frontend_available' => true, ] ); $this->add_control( 'pause_on_hover', [ 'label' => esc_html__('Pause on Hover', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', 'condition' => [ 'autoplay' => 'yes', ], 'frontend_available' => true, ] ); $this->add_control( 'show_dots', [ 'label' => esc_html__('Show Dots', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'show_arrows', [ 'label' => esc_html__('Show Arrows', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', 'frontend_available' => true, ] ); $this->end_controls_section(); // ===================== // STYLE TAB // ===================== // Container Style $this->start_controls_section( 'container_style_section', [ 'label' => esc_html__('Container', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'container_background', [ 'label' => esc_html__('Background Color', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .awke-testimonial-widget' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'container_border', 'selector' => '{{WRAPPER}} .awke-testimonial-widget', ] ); $this->add_responsive_control( 'container_border_radius', [ 'label' => esc_html__('Border Radius', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', '%'], 'selectors' => [ '{{WRAPPER}} .awke-testimonial-widget' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Box_Shadow::get_type(), [ 'name' => 'container_shadow', 'selector' => '{{WRAPPER}} .awke-testimonial-widget', ] ); $this->add_responsive_control( 'container_padding', [ 'label' => esc_html__('Padding', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .awke-testimonial-widget' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); // Content Style $this->start_controls_section( 'content_style_section', [ 'label' => esc_html__('Content', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'content_color', [ 'label' => esc_html__('Text Color', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .awke-testimonial-content' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'content_typography', 'selector' => '{{WRAPPER}} .awke-testimonial-content', ] ); $this->add_responsive_control( 'content_spacing', [ 'label' => esc_html__('Bottom Spacing', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .awke-testimonial-content' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); // Name Style $this->start_controls_section( 'name_style_section', [ 'label' => esc_html__('Client Name', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'name_color', [ 'label' => esc_html__('Color', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .awke-client-name' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'name_typography', 'selector' => '{{WRAPPER}} .awke-client-name', ] ); $this->add_responsive_control( 'name_spacing', [ 'label' => esc_html__('Bottom Spacing', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .awke-client-name' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); // Title Style $this->start_controls_section( 'title_style_section', [ 'label' => esc_html__('Client Title/Position', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'title_color', [ 'label' => esc_html__('Color', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .awke-client-title' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'selector' => '{{WRAPPER}} .awke-client-title', ] ); $this->add_responsive_control( 'title_spacing', [ 'label' => esc_html__('Bottom Spacing', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .awke-client-title' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); // Image Style $this->start_controls_section( 'image_style_section', [ 'label' => esc_html__('Client Image', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'image_size', [ 'label' => esc_html__('Image Size', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 40, 'max' => 200, ], ], 'selectors' => [ '{{WRAPPER}} .awke-client-image img' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'image_border_radius', [ 'label' => esc_html__('Border Radius', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', '%'], 'default' => [ 'top' => 50, 'right' => 50, 'bottom' => 50, 'left' => 50, 'unit' => '%', ], 'selectors' => [ '{{WRAPPER}} .awke-client-image img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'image_border', 'selector' => '{{WRAPPER}} .awke-client-image img', ] ); $this->add_responsive_control( 'image_spacing', [ 'label' => esc_html__('Bottom Spacing', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .awke-client-image' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); // Rating Style $this->start_controls_section( 'rating_style_section', [ 'label' => esc_html__('Rating Stars', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'rating_color', [ 'label' => esc_html__('Star Color (Filled)', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#ffc107', 'selectors' => [ '{{WRAPPER}} .awke-star' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'rating_empty_color', [ 'label' => esc_html__('Star Color (Empty)', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#e0e0e0', 'selectors' => [ '{{WRAPPER}} .awke-star.empty' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'rating_size', [ 'label' => esc_html__('Star Size', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 10, 'max' => 40, ], ], 'selectors' => [ '{{WRAPPER}} .awke-star' => 'font-size: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'rating_spacing', [ 'label' => esc_html__('Spacing Between Stars', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 20, ], ], 'selectors' => [ '{{WRAPPER}} .awke-rating' => 'gap: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); // Quote Marks Style $this->start_controls_section( 'quote_style_section', [ 'label' => esc_html__('Quote Marks', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'condition' => [ 'design_style' => ['classic', 'image-left'], ], ] ); $this->add_control( 'show_quote_marks', [ 'label' => esc_html__('Show Quote Marks', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', 'selectors' => [ '{{WRAPPER}} .awke-testimonial-content::before' => 'display: {{VALUE}};', ], 'selectors_dictionary' => [ 'yes' => 'block', '' => 'none', ], ] ); $this->add_control( 'quote_color', [ 'label' => esc_html__('Quote Mark Color', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .awke-testimonial-content::before' => 'color: {{VALUE}};', ], 'condition' => [ 'show_quote_marks' => 'yes', ], ] ); $this->add_responsive_control( 'quote_size', [ 'label' => esc_html__('Quote Mark Size', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 30, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .awke-testimonial-content::before' => 'font-size: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'show_quote_marks' => 'yes', ], ] ); $this->end_controls_section(); // Bubble Style $this->start_controls_section( 'bubble_style_section', [ 'label' => esc_html__('Bubble', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'condition' => [ 'design_style' => 'bubble', ], ] ); $this->add_control( 'bubble_background', [ 'label' => esc_html__('Bubble Background', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .awke-design-bubble .awke-testimonial-content' => 'background-color: {{VALUE}};', '{{WRAPPER}} .awke-design-bubble .awke-testimonial-content::after' => 'border-top-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'bubble_padding', [ 'label' => esc_html__('Bubble Padding', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em'], 'selectors' => [ '{{WRAPPER}} .awke-design-bubble .awke-testimonial-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'bubble_border_radius', [ 'label' => esc_html__('Bubble Border Radius', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .awke-design-bubble .awke-testimonial-content' => 'border-radius: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); // Accent Border Color (for Card) $this->start_controls_section( 'accent_style_section', [ 'label' => esc_html__('Accent Border', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'condition' => [ 'design_style' => 'card', ], ] ); $this->add_control( 'accent_color', [ 'label' => esc_html__('Accent Color', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#667eea', 'selectors' => [ '{{WRAPPER}} .awke-card-border-left' => 'border-left-color: {{VALUE}};', '{{WRAPPER}} .awke-card-border-right' => 'border-right-color: {{VALUE}};', '{{WRAPPER}} .awke-card-border-top' => 'border-top-color: {{VALUE}};', '{{WRAPPER}} .awke-card-border-bottom' => 'border-bottom-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'accent_width', [ 'label' => esc_html__('Accent Width', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 10, ], ], 'selectors' => [ '{{WRAPPER}} .awke-card-border-left' => 'border-left-width: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .awke-card-border-right' => 'border-right-width: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .awke-card-border-top' => 'border-top-width: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .awke-card-border-bottom' => 'border-bottom-width: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); } /** * Render widget output on the frontend. */ protected function render() { $settings = $this->get_settings_for_display(); // Check data source if ($settings['data_source'] === 'dynamic') { $this->render_dynamic_testimonials($settings); } elseif ($settings['testimonial_style'] === 'single') { $this->render_single_testimonial($settings); } else { $this->render_carousel_testimonials($settings); } } /** * Get design modifier classes based on settings */ private function get_design_modifier_classes($settings) { $classes = []; // Card design modifiers if (isset($settings['card_image_position'])) { $classes[] = 'awke-card-img-' . $settings['card_image_position']; } if (isset($settings['card_border_side'])) { $classes[] = 'awke-card-border-' . $settings['card_border_side']; } // Bubble design modifiers if (isset($settings['bubble_tail_position'])) { $classes[] = 'awke-bubble-tail-' . $settings['bubble_tail_position']; } // Image side modifiers if (isset($settings['image_side_position'])) { $classes[] = 'awke-img-side-' . $settings['image_side_position']; } return implode(' ', $classes); } /** * Render single testimonial */ private function render_single_testimonial($settings) { $design_class = isset($settings['design_style']) ? 'awke-design-' . $settings['design_style'] : 'awke-design-classic'; // Add design-specific modifier classes $modifier_classes = $this->get_design_modifier_classes($settings); $max_stars = isset($settings['max_stars']) ? intval($settings['max_stars']) : 5; echo '
'; } /** * Render carousel testimonials */ private function render_carousel_testimonials($settings) { if (empty($settings['testimonials'])) { return; } $carousel_settings = [ 'slides_to_show' => $settings['slides_to_show'], 'autoplay' => $settings['autoplay'] === 'yes', 'autoplay_speed' => $settings['autoplay_speed'], 'pause_on_hover' => $settings['pause_on_hover'] === 'yes', 'show_dots' => $settings['show_dots'] === 'yes', 'show_arrows' => $settings['show_arrows'] === 'yes', ]; $this->add_render_attribute('carousel-wrapper', [ 'class' => 'awke-testimonial-carousel', 'data-carousel-settings' => wp_json_encode($carousel_settings), 'data-slides' => isset($settings['slides_to_show']) ? $settings['slides_to_show'] : '1', ]); ?>' . esc_html__('No testimonials found.', 'advanced-widget-kit-for-elementor') . '
'; wp_reset_postdata(); return; } // Check if we have enough items for carousel $slides_to_show = isset($settings['slides_to_show']) ? intval($settings['slides_to_show']) : 1; if ($query->post_count <= $slides_to_show && defined('WP_DEBUG') && WP_DEBUG && current_user_can('manage_options')) { echo '