start_controls_section( 'section_content', [ 'label' => __( 'Post Title', 'admore-widgets-suite' ), ] ); $this->add_control( 'title_tag', [ 'label' => __( 'HTML Tag', 'admore-widgets-suite' ), 'type' => Controls_Manager::SELECT, 'default' => 'h1', 'options' => [ 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'p' => 'P', 'span' => 'SPAN' ], ] ); $this->add_control( 'link_to_post', [ 'label' => __( 'Link to Post', 'admore-widgets-suite' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', ] ); $this->add_control( 'link_target', [ 'label' => __( 'Open in New Tab', 'admore-widgets-suite' ), 'type' => Controls_Manager::SWITCHER, 'condition' => [ 'link_to_post' => 'yes' ], ] ); $this->add_control( 'alignment', [ 'label' => __( 'Alignment', 'admore-widgets-suite' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'admore-widgets-suite' ), 'icon' => 'eicon-text-align-left' ], 'center' => [ 'title' => __( 'Center', 'admore-widgets-suite' ), 'icon' => 'eicon-text-align-center' ], 'right' => [ 'title' => __( 'Right', 'admore-widgets-suite' ), 'icon' => 'eicon-text-align-right' ], ], 'default' => 'center', 'selectors' => [ '{{WRAPPER}} .eppro-post-title' => 'text-align: {{VALUE}};' ], ] ); $this->end_controls_section(); $this->start_controls_section( 'style_title', [ 'label' => __( 'Title', 'admore-widgets-suite' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'selector' => '{{WRAPPER}} .eppro-post-title, {{WRAPPER}} .eppro-post-title a', ] ); $this->add_control( 'title_color', [ 'label' => __( 'Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eppro-post-title, {{WRAPPER}} .eppro-post-title a' => 'color: {{VALUE}};' ], ] ); $this->add_control( 'title_hover_color', [ 'label' => __( 'Hover Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eppro-post-title a:hover' => 'color: {{VALUE}};' ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'title_shadow', 'selector' => '{{WRAPPER}} .eppro-post-title', ] ); $this->add_responsive_control( 'title_margin', [ 'label' => __( 'Margin', 'admore-widgets-suite' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em' ], 'selectors' => [ '{{WRAPPER}} .eppro-post-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' ], ] ); $this->end_controls_section(); } protected function render(): void { $s = $this->get_settings_for_display(); $tag = esc_attr( $s['title_tag'] ); $title = get_the_title(); if ( ! $title ) { if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) { $title = esc_html__( 'Post Title Placeholder', 'admore-widgets-suite' ); } else { return; } } $inner = esc_html( $title ); if ( 'yes' === $s['link_to_post'] && get_the_permalink() ) { $target = ( 'yes' === ( $s['link_target'] ?? '' ) ) ? ' target="_blank"' : ''; $inner = '' . esc_html( $title ) . ''; } echo wp_kses_post( '<' . $tag . ' class="eppro-post-title">' . $inner . '' ); } }