start_controls_section( 'section_content', [ 'label' => __( 'Comments', 'admore-widgets-suite' ), ] ); $this->add_control( 'section_title', [ 'label' => __( 'Section Title', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => __( 'Comments', 'admore-widgets-suite' ), 'dynamic' => [ 'active' => true ], ] ); $this->add_control( 'show_count', [ 'label' => __( 'Show Comment Count', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', ] ); $this->add_control( 'show_form', [ 'label' => __( 'Show Comment Form', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', ] ); $this->add_control( 'show_avatar', [ 'label' => __( 'Show Avatars', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', ] ); $this->add_control( 'avatar_size', [ 'label' => __( 'Avatar Size', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 24, 'max' => 80 ] ], 'default' => [ 'size' => 44 ], 'condition' => [ 'show_avatar' => 'yes' ], 'selectors' => [ '{{WRAPPER}} .eppro-pc-avatar img' => 'width: {{SIZE}}px; height: {{SIZE}}px;' ], ] ); $this->end_controls_section(); /* ── Style ── */ $this->start_controls_section( 'section_style', [ 'label' => __( 'Style', 'admore-widgets-suite' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'comment_bg', [ 'label' => __( 'Comment Background', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#f8fafc', 'selectors' => [ '{{WRAPPER}} .eppro-pc-comment' => 'background: {{VALUE}};' ], ] ); $this->add_control( 'comment_radius', [ 'label' => __( 'Border Radius', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 20 ] ], 'default' => [ 'size' => 10 ], 'selectors' => [ '{{WRAPPER}} .eppro-pc-comment' => 'border-radius: {{SIZE}}px;' ], ] ); $this->add_control( 'name_color', [ 'label' => __( 'Name Color', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#1e293b', 'selectors' => [ '{{WRAPPER}} .eppro-pc-author' => 'color: {{VALUE}};' ], ] ); $this->add_control( 'text_color', [ 'label' => __( 'Comment Text Color', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#475569', 'selectors' => [ '{{WRAPPER}} .eppro-pc-text' => 'color: {{VALUE}};' ], ] ); $this->add_control( 'accent_color', [ 'label' => __( 'Accent Color', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#7c3aed', 'selectors' => [ '{{WRAPPER}} .eppro-pc-reply-link' => 'color: {{VALUE}};', '{{WRAPPER}} .eppro-pc-submit-btn' => 'background: {{VALUE}}; border-color: {{VALUE}};', '{{WRAPPER}} .eppro-pc-input:focus' => 'border-color: {{VALUE}};', ], ] ); $this->add_control( 'date_color', [ 'label' => __( 'Date Color', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#94a3b8', 'selectors' => [ '{{WRAPPER}} .eppro-pc-date' => 'color: {{VALUE}};' ], ] ); $this->add_control( 'heading_color', [ 'label' => __( 'Section Heading Color', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::COLOR, 'separator' => 'before', 'selectors' => [ '{{WRAPPER}} .eppro-pc-heading' => 'color: {{VALUE}};' ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'heading_typography', 'selector' => '{{WRAPPER}} .eppro-pc-heading', ] ); $this->add_responsive_control( 'comment_padding', [ 'label' => __( 'Comment Padding', 'admore-widgets-suite' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em' ], 'default' => [ 'top'=>'16','right'=>'16','bottom'=>'16','left'=>'16','unit'=>'px' ], 'selectors' => [ '{{WRAPPER}} .eppro-pc-comment' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], 'separator' => 'before', ] ); $this->add_group_control( \Elementor\Group_Control_Box_Shadow::get_type(), [ 'name' => 'comment_shadow', 'selector' => '{{WRAPPER}} .eppro-pc-comment', ] ); $this->end_controls_section(); } protected function render(): void { $s = $this->get_settings_for_display(); $post_id = get_the_ID(); $show_form = 'yes' === ( $s['show_form'] ?? 'yes' ); $show_avtr = 'yes' === ( $s['show_avatar'] ?? 'yes' ); $avtr_size = intval( $s['avatar_size']['size'] ?? 44 ); $title = $s['section_title'] ?? __('Comments','admore-widgets-suite'); if ( ! $post_id ) { if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) { echo '

' . esc_html__( 'Post Comments', 'admore-widgets-suite' ) . '

' . esc_html__( 'Comments will display on actual post/page templates.', 'admore-widgets-suite' ) . '

'; } return; } $comments = get_comments([ 'post_id' => $post_id, 'status' => 'approve', 'parent' => 0, ]); $count = get_comments_number( $post_id ); ?>

()

    $post_id, 'status' => 'approve', 'parent' => $comment->comment_ID, ]); ?>
  1. __('Reply','admore-widgets-suite'), 'class' => 'eppro-pc-reply-link', 'before' => '
    ', 'after' => '
    ' ], $comment, $post_id ); ?>

'eppro-pc-form', 'class_submit' => 'eppro-pc-submit-btn', 'fields' => [ 'author' => '

', 'email' => '

', 'url' => '', ], 'comment_field' => '

', 'title_reply' => '', 'label_submit' => esc_html__('Post Comment','admore-widgets-suite'), ]); ?>