D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
realadss
/
thathagroup.com
/
wp-content
/
themes
/
prooty
/
elementor
/
widgets
/
Filename :
heading.php
back
Copy
<?php use Elementor\Widget_Base; use Elementor\Controls_Manager; use \Elementor\Group_Control_Typography; use Elementor\Utils; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly class Prooty_Elementor_Heading extends Widget_Base { public function get_name() { return 'prooty_elementor_heading'; } public function get_title() { return esc_html__( 'Ova Heading', 'prooty' ); } public function get_icon() { return 'eicon-heading'; } public function get_categories() { return [ 'prooty' ]; } public function get_script_depends() { return [ '' ]; } // Add Your Controll In This Function protected function register_controls() { $this->start_controls_section( 'section_content', [ 'label' => esc_html__( 'Content', 'prooty' ), ] ); $this->add_control( 'sub_title_pre', [ 'label' => esc_html__( 'Sub Title Prefix', 'prooty' ), 'type' => Controls_Manager::TEXT, 'default' => '//', ] ); $this->add_control( 'sub_title', [ 'label' => esc_html__( 'Sub Title', 'prooty' ), 'type' => Controls_Manager::TEXT, 'default' => 'Sub title', ] ); $this->add_control( 'title', [ 'label' => esc_html__( 'Title', 'prooty' ), 'type' => Controls_Manager::TEXTAREA, 'default' => 'Title', ] ); $this->add_control( 'description', [ 'label' => esc_html__( 'Description', 'prooty' ), 'type' => Controls_Manager::TEXTAREA, 'default' => '' ] ); $this->add_control( 'link_address', [ 'label' => esc_html__( 'Link', 'prooty' ), 'type' => \Elementor\Controls_Manager::URL, 'show_external' => false, 'default' => [ 'url' => '', 'is_external' => false, 'nofollow' => false, ], ] ); $this->add_control( 'html_tag', [ 'label' => esc_html__( 'HTML Tag', 'prooty' ), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'h2', 'options' => [ 'h1' => esc_html__( 'H1', 'prooty' ), 'h2' => esc_html__( 'H2', 'prooty' ), 'h3' => esc_html__( 'H3', 'prooty' ), 'h4' => esc_html__( 'H4', 'prooty' ), 'h5' => esc_html__( 'H5', 'prooty' ), 'h6' => esc_html__( 'H6', 'prooty' ), 'div' => esc_html__( 'Div', 'prooty' ), 'span' => esc_html__( 'span', 'prooty' ), 'p' => esc_html__( 'p', 'prooty' ), ], ] ); $this->add_responsive_control( 'align_heading', [ 'label' => esc_html__( 'Alignment', 'prooty' ), 'type' => \Elementor\Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__( 'Left', 'prooty' ), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => esc_html__( 'Center', 'prooty' ), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => esc_html__( 'Right', 'prooty' ), 'icon' => 'eicon-text-align-right', ], ], 'default' => 'center', 'toggle' => true, 'selectors' => [ '{{WRAPPER}} .ova-heading' => 'text-align: {{VALUE}}', '{{WRAPPER}} .ova-heading .top-heading:before' => 'background-position: bottom {{VALUE}}', ], ] ); $this->add_control( 'background_heading', [ 'label' => esc_html__( 'Background', 'prooty' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before' ] ); $this->add_group_control( \Elementor\Group_Control_Background::get_type(), [ 'name' => 'background', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .ova-heading .top-heading:before', ] ); $this->add_control( 'invert_background_image_color', [ 'label' => esc_html__( 'Invert Color', 'prooty' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'no', 'options' => [ 'yes' => esc_html__( 'Yes', 'prooty' ), 'no' => esc_html__( 'No', 'prooty' ), ], 'frontend_available' => true, ] ); $this->end_controls_section(); //SECTION TAB STYLE SUB TITLE PREFIX $this->start_controls_section( 'section_sub_title_pre', [ 'label' => esc_html__( 'Sub Title Prefix', 'prooty' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'content_typography_sub_title_pre', 'label' => esc_html__( 'Typography', 'prooty' ), 'selector' => '{{WRAPPER}} .ova-heading .sub-title-pre', ] ); $this->add_control( 'color_sub_title_pre', [ 'label' => esc_html__( 'Color', 'prooty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-heading .sub-title-pre' => 'color : {{VALUE}};' ], ] ); $this->add_responsive_control( 'margin_sub_title_pre', [ 'label' => esc_html__( 'Margin', 'prooty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-heading .sub-title-pre' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); //END SECTION TAB STYLE SUB TITLE PREFIX //SECTION TAB STYLE SUB TITLE $this->start_controls_section( 'section_sub_title', [ 'label' => esc_html__( 'Sub Title', 'prooty' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'content_typography_sub_title', 'label' => esc_html__( 'Typography', 'prooty' ), 'selector' => '{{WRAPPER}} .ova-heading .sub-title', ] ); $this->add_control( 'color_sub_title', [ 'label' => esc_html__( 'Color', 'prooty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-heading .sub-title' => 'color : {{VALUE}};' ], ] ); $this->add_responsive_control( 'padding_sub_title', [ 'label' => esc_html__( 'Padding', 'prooty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-heading .sub-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'margin_sub_title', [ 'label' => esc_html__( 'Margin', 'prooty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-heading .sub-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); //END SECTION TAB STYLE SUB TITLE //SECTION TAB STYLE TITLE $this->start_controls_section( 'section_title_style', [ 'label' => esc_html__( 'Title', 'prooty' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'content_typography_title', 'label' => esc_html__( 'Typography', 'prooty' ), 'selector' => '{{WRAPPER}} .ova-heading .title', ] ); $this->add_control( 'color_title', [ 'label' => esc_html__( 'Color', 'prooty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-heading .title, {{WRAPPER}} .ova-heading .title a' => 'color : {{VALUE}};', ], ] ); $this->add_control( 'color_title_hover', [ 'label' => esc_html__( 'Color Hover', 'prooty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-heading .title:hover, {{WRAPPER}} .ova-heading .title:hover a' => 'color : {{VALUE}};' ], ] ); $this->add_responsive_control( 'padding_title', [ 'label' => esc_html__( 'Padding', 'prooty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-heading .title ' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'margin_title', [ 'label' => esc_html__( 'Margin', 'prooty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-heading .title ' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); //END SECTION TAB STYLE TITLE //SECTION TAB STYLE DESCRIPTION $this->start_controls_section( 'section_description', [ 'label' => esc_html__( 'Description', 'prooty' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'content_typography_description', 'label' => esc_html__( 'Typography', 'prooty' ), 'selector' => '{{WRAPPER}} .ova-heading .description', ] ); $this->add_control( 'color_description', [ 'label' => esc_html__( 'Color', 'prooty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-heading .description' => 'color : {{VALUE}};' ], ] ); $this->add_responsive_control( 'padding_description', [ 'label' => esc_html__( 'Padding', 'prooty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-heading .description ' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'margin_description', [ 'label' => esc_html__( 'Margin', 'prooty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-heading .description ' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); //END SECTION TAB STYLE DESCRIPTION } // Render Template Here protected function render() { $settings = $this->get_settings(); $sub_title_pre = $settings['sub_title_pre']; $sub_title = $settings['sub_title']; $title = $settings['title']; $description = $settings['description']; $html_tag = $settings['html_tag']; $link = $settings['link_address']['url']; $target = $settings['link_address']['is_external'] ? ' target="_blank"' : ''; $invert_background_image_color = $settings['invert_background_image_color']; if ( $invert_background_image_color == 'yes') { $class_invert = 'invert-color'; } else { $class_invert = ''; } ?> <div class="ova-heading"> <div class="top-heading <?php echo esc_attr($class_invert); ?>"> <?php if( $sub_title ): ?> <div class="sub-title-wrapper"> <?php if( $sub_title_pre ): ?> <span class="sub-title-pre"><?php echo esc_html( $sub_title_pre ); ?></span> <?php endif; ?> <h3 class="sub-title"><?php echo esc_html( $sub_title ); ?></h3> </div> <?php endif; ?> <?php if( $title) : ?> <?php if( $link ) { ?> <<?php echo esc_attr($html_tag); ?> class="title"><a href="<?php echo esc_url( $link ); ?>"<?php printf( $target ); ?>><?php printf($title);?></a></<?php echo esc_attr( $html_tag ); ?>> <?php } else { ?> <<?php echo esc_attr($html_tag); ?> class="title"><?php printf($title); ?></<?php echo esc_attr( $html_tag ); ?>> <?php } ?> <?php endif; ?> </div> <?php if( $description ): ?> <p class="description"><?php echo esc_html( $description ); ?></p> <?php endif; ?> </div> <?php } } $widgets_manager->register( new Prooty_Elementor_Heading() );