experiments->is_feature_active( 'e_optimized_markup' ); } /** * Register heading widget controls. * * Adds different input fields to allow the user to change and customize the widget settings. * * @since 3.1.0 * @access protected */ protected function register_controls() { $this->start_controls_section( 'section_title', [ 'label' => esc_html__( 'Title', 'uicore-elements' ), ] ); $this->add_control( 'header_size', [ 'label' => esc_html__( 'HTML Tag', 'uicore-elements' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'h6' => 'H6', 'div' => 'div', 'span' => 'span', 'p' => 'p', ], 'default' => 'h2', ] ); $this->add_responsive_control( 'align', [ 'label' => esc_html__( 'Alignment', 'uicore-elements' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__( 'Left', 'uicore-elements' ), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => esc_html__( 'Center', 'uicore-elements' ), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => esc_html__( 'Right', 'uicore-elements' ), 'icon' => 'eicon-text-align-right', ], 'justify' => [ 'title' => esc_html__( 'Justified', 'uicore-elements' ), 'icon' => 'eicon-text-align-justify', ], ], 'default' => '', 'selectors' => [ '{{WRAPPER}}' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'view', [ 'label' => esc_html__( 'View', 'uicore-elements' ), 'type' => Controls_Manager::HIDDEN, 'default' => 'traditional', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_title_style', [ 'label' => esc_html__( 'Title', 'uicore-elements' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'title_color', [ 'label' => esc_html__( 'Text Color', 'uicore-elements' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .elementor-heading-title' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'typography', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, ], 'selector' => '{{WRAPPER}} .elementor-heading-title', ] ); $this->add_group_control( Group_Control_Text_Stroke::get_type(), [ 'name' => 'text_stroke', 'selector' => '{{WRAPPER}} .elementor-heading-title', ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'text_shadow', 'selector' => '{{WRAPPER}} .elementor-heading-title', ] ); $this->add_control( 'blend_mode', [ 'label' => esc_html__( 'Blend Mode', 'uicore-elements' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => esc_html__( 'Normal', 'uicore-elements' ), 'multiply' => 'Multiply', 'screen' => 'Screen', 'overlay' => 'Overlay', 'darken' => 'Darken', 'lighten' => 'Lighten', 'color-dodge' => 'Color Dodge', 'saturation' => 'Saturation', 'color' => 'Color', 'difference' => 'Difference', 'exclusion' => 'Exclusion', 'hue' => 'Hue', 'luminosity' => 'Luminosity', ], 'selectors' => [ '{{WRAPPER}} .elementor-heading-title' => 'mix-blend-mode: {{VALUE}}', ], 'separator' => 'none', ] ); $this->end_controls_section(); } /** * Render heading 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(); $this->add_render_attribute( 'title', 'class', 'elementor-heading-title' ); if( !\Elementor\Plugin::$instance->editor->is_edit_mode() ) { // If there is a post. if ( is_single() || ( is_home() && ! is_front_page() ) || ( is_page() && ! is_front_page() ) ) { $title = single_post_title( '', false ); }else{ $title = wp_title(null,false); } $title = $title ? $title : get_bloginfo('name'); }else{ $title = __( 'This is a dummy title.', 'uicore-elements' ); } $title_html = sprintf( '<%1$s %2$s>%3$s', Utils::validate_html_tag($settings['header_size']), $this->get_render_attribute_string( 'title' ), \esc_html($title) ); // PHPCS - the variable $title_html holds safe data. echo $title_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Render heading widget output in the editor. * * Written as a Backbone JavaScript template and used to generate the live preview. * * @since 2.9.0 * @access protected */ protected function content_template() { } } \Elementor\Plugin::instance()->widgets_manager->register(new TheTitle());