start_controls_section( 'section_content', [ 'label' => esc_html__( 'Ova Counter', 'nighty' ), ] ); $this->add_control( 'template', [ 'label' => esc_html__( 'Template', 'nighty' ), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'template1', 'options' => [ 'template1' => esc_html__( 'Template 1', 'nighty' ), 'template2' => esc_html__( 'Template 2', 'nighty' ), ], ] ); $this->add_control( 'number', [ 'label' => esc_html__( 'Number', 'nighty' ), 'type' => Controls_Manager::NUMBER, 'default' => esc_html__( '1.6', 'nighty' ), ] ); $this->add_control( 'suffix', [ 'label' => esc_html__( 'Suffix', 'nighty' ), 'type' => Controls_Manager::TEXT, 'default' => 'K', ] ); $this->add_control( 'title', [ 'label' => esc_html__( 'Title', 'nighty' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Total Users', 'nighty' ), ] ); $this->add_responsive_control( 'text_align', [ 'label' => esc_html__( 'Alignment', 'nighty' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__( 'Left', 'nighty' ), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => esc_html__( 'Center', 'nighty' ), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => esc_html__( 'Right', 'nighty' ), 'icon' => 'eicon-text-align-right', ], ], 'default' => 'center', 'selectors' => [ '{{WRAPPER}} .ova-counter' => 'text-align: {{VALUE}};', ], ] ); $this->add_responsive_control( 'show_line_decoration', [ 'label' => esc_html__( 'Show Line Decoration', 'nighty' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Show', 'nighty' ), 'label_off' => esc_html__( 'Hide', 'nighty' ), 'return_value' => 'yes', 'default' => 'yes', ] ); $this->end_controls_section(); /* Begin Counter Style */ $this->start_controls_section( 'counter_style', [ 'label' => esc_html__( 'Ova Counter', 'nighty' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'counter_bgcolor', [ 'label' => esc_html__( 'Background', 'nighty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-counter' => 'background: {{VALUE}};', ], ] ); $this->add_responsive_control( 'counter_padding', [ 'label' => esc_html__( 'Padding', 'nighty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .ova-counter' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'counter_border', 'selector' => '{{WRAPPER}} .ova-counter', ] ); $this->add_responsive_control( 'counter_border_radius', array( 'label' => esc_html__( 'Border Radius', 'nighty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%' ), 'selectors' => array( '{{WRAPPER}} .ova-counter' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ) ); $this->end_controls_section(); /* End counter style */ /* Begin number (odometer) Style */ $this->start_controls_section( 'number_style', [ 'label' => esc_html__( 'Number', 'nighty' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'number_typography', 'selector' => '{{WRAPPER}} .ova-counter .odometer', ] ); $this->add_control( 'number_color', [ 'label' => esc_html__( 'Color', 'nighty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-counter .odometer' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'number_padding', [ 'label' => esc_html__( 'Padding', 'nighty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .ova-counter .odometer' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); /* End number style */ /* Begin suffix Style */ $this->start_controls_section( 'suffix_style', [ 'label' => esc_html__( 'Suffix', 'nighty' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'suffix_typography', 'selector' => '{{WRAPPER}} .ova-counter .suffix', ] ); $this->add_control( 'suffix_color', [ 'label' => esc_html__( 'Color', 'nighty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-counter .suffix' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'suffix_padding', [ 'label' => esc_html__( 'Padding', 'nighty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .ova-counter .suffix' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); /* End suffix style */ /* Begin title Style */ $this->start_controls_section( 'title_style', [ 'label' => esc_html__( 'Title', 'nighty' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'selector' => '{{WRAPPER}} .ova-counter .title', ] ); $this->add_control( 'title_color', [ 'label' => esc_html__( 'Color', 'nighty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-counter .title' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'title_margin', [ 'label' => esc_html__( 'Margin', 'nighty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .ova-counter .title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); /* End title style */ /* Begin LINE DECORATION Style */ $this->start_controls_section( 'line_decoration_style', [ 'label' => esc_html__( 'Line Decoration', 'nighty' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'show_line_decoration' => 'yes', ], ] ); $this->add_responsive_control( 'line_decoration_width', [ 'label' => esc_html__( 'Width', 'nighty' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 300, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ova-counter .line-decoration' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'line_decoration_height', [ 'label' => esc_html__( 'Height', 'nighty' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 300, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ova-counter .line-decoration' => 'height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'line_decoration_color', [ 'label' => esc_html__( 'Color', 'nighty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-counter .line-decoration' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'line_decoration_margin', [ 'label' => esc_html__( 'Margin', 'nighty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .ova-counter .line-decoration' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); /* End LINE DECORATION style */ } // Render Template Here protected function render() { $settings = $this->get_settings(); $template = $settings['template']; $number = isset( $settings['number'] ) ? $settings['number'] : '100'; $suffix = $settings['suffix']; $title = $settings['title']; $show_line_decoration = $settings['show_line_decoration']; ?>