start_controls_section( 'section_content', [ 'label' => __( 'Site Title', 'admore-widgets-suite' ), ] ); $this->add_control( 'title_tag', [ 'label' => __( 'HTML Tag', 'admore-widgets-suite' ), 'type' => Controls_Manager::SELECT, 'default' => 'h2', 'options' => [ 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'p' => 'P', 'span' => 'SPAN' ], ] ); $this->add_control( 'link_to_home', [ 'label' => __( 'Link to Home', 'admore-widgets-suite' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', ] ); $this->add_control( 'custom_title', [ 'label' => __( 'Custom Text', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'placeholder' => get_bloginfo( 'name' ), 'description' => __( 'Leave empty to use the site name.', 'admore-widgets-suite' ), ] ); $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-site-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-site-title, {{WRAPPER}} .eppro-site-title a', ] ); $this->add_control( 'title_color', [ 'label' => __( 'Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#1e293b', 'selectors' => [ '{{WRAPPER}} .eppro-site-title, {{WRAPPER}} .eppro-site-title a' => 'color: {{VALUE}};' ], ] ); $this->add_control( 'title_hover_color', [ 'label' => __( 'Hover Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eppro-site-title a:hover' => 'color: {{VALUE}};' ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'title_shadow', 'selector' => '{{WRAPPER}} .eppro-site-title', ] ); $this->end_controls_section(); } protected function render(): void { $s = $this->get_settings_for_display(); $tag = esc_attr( $s['title_tag'] ); $title = ! empty( $s['custom_title'] ) ? esc_html( $s['custom_title'] ) : esc_html( get_bloginfo( 'name' ) ); $inner = ( 'yes' === $s['link_to_home'] ) ? '' . $title . '' : $title; echo wp_kses_post( '<' . $tag . ' class="eppro-site-title">' . $inner . '' ); } }