Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
firepot
/
wp-content
/
plugins
/
cyarb-toolkit
/
widgets
:
funfacts-two.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php /** * Funfacts Two Widget */ namespace Elementor; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } class Cyarb_Funfacts_Two extends Widget_Base { public function get_name() { return 'Cyarb_FunfactsTwo'; } public function get_title() { return __( 'Funfacts Two', 'cyarb-toolkit' ); } public function get_icon() { return 'eicon-counter'; } public function get_categories() { return [ 'cyarb-elements' ]; } protected function register_controls() { $this->start_controls_section( 'funfacts_section', [ 'label' => __( 'Funfacts Two Control', 'cyarb-toolkit' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'sec_style', [ 'label' => __( 'Choose Style', 'cyarb-toolkit' ), 'type' => Controls_Manager::SELECT, 'options' => [ '1' => __( 'Style One', 'cyarb-toolkit' ), '2' => __( 'Style Two', 'cyarb-toolkit' ), ], 'default' => '1', ] ); $repeater = new Repeater(); $repeater->add_control( 'icon_class', [ 'label' => __( 'Icon Class', 'cyarb-toolkit' ), 'type' => Controls_Manager::TEXT, ] ); $repeater->add_control( 'number', [ 'type' => Controls_Manager::NUMBER, 'label' => esc_html__( 'Ending Number', 'cyarb-toolkit' ), ] ); $repeater->add_control( 'number_suffix', [ 'type' => Controls_Manager::TEXT, 'label' => esc_html__( 'Ending Number Suffix', 'cyarb-toolkit' ), ] ); $repeater->add_control( 'title', [ 'type' => Controls_Manager::TEXT, 'label' => esc_html__( 'Title', 'cyarb-toolkit' ), ] ); $this->add_control( 'items', [ 'label' => esc_html__( 'Add Counter Item', 'cyarb-toolkit' ), 'type' => Controls_Manager::REPEATER, 'fields' => $repeater->get_controls(), ] ); $this->end_controls_section(); $this->start_controls_section( 'counter_style', [ 'label' => __( 'Style', 'cyarb-toolkit' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'sec_bg_color', 'label' => esc_html__( 'Section Background Color', 'cyarb-toolkit' ), 'types' => ['gradient' ], 'selector' => '{{WRAPPER}} .funfacts-style-two-area', ] ); $this->add_control( 'top_td', [ 'type' => Controls_Manager::DIVIDER, ] ); $this->add_control( 'icon_color', [ 'label' => __( 'Icon Color', 'cyarb-toolkit' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .single-funfacts-card .icon i' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'icon_bg_color', [ 'label' => __( 'Icon Background Color', 'cyarb-toolkit' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .single-funfacts-card .icon i' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'counter_color', [ 'label' => __( 'Number Color', 'cyarb-toolkit' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .single-funfacts-card h3' => 'color: {{VALUE}}', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'counter_typography', 'label' => __( 'Number Typography', 'cyarb-toolkit' ), 'selector' => '{{WRAPPER}} .single-funfacts-card h3', ] ); $this->add_control( 'title_color', [ 'label' => __( 'Title Color', 'cyarb-toolkit' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .single-funfacts-card p' => 'color: {{VALUE}}', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'label' => __( 'Title Typography', 'cyarb-toolkit' ), 'selector' => '{{WRAPPER}} .single-funfacts-card p', ] ); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings_for_display(); ?> <?php if( $settings['sec_style'] == '1' ): ?> <div class="funfacts-style-two-area pt-100 pb-75"> <div class="container"> <div class="row"> <?php foreach( $settings['items'] as $item ): ?> <div class="col-lg-3 col-sm-3 col-6 col-md-3"> <div class="single-funfacts-card"> <?php if( $item['icon_class'] != '' ) : ?> <div class="icon"> <i class="<?php echo esc_attr( $item['icon_class'] ); ?>"></i> </div> <?php endif; ?> <h3><span class="odometer" data-count="<?php echo esc_attr( $item['number'] ); ?>"><?php echo esc_attr__( '00' ); ?></span><span class="sign"><?php echo esc_html( $item['number_suffix'] ); ?></span></h3> <p><?php echo esc_html( $item['title'] ); ?></p> </div> </div> <?php endforeach; ?> </div> </div> </div> <?php else: ?> <div class="funfacts-box-style-area"> <div class="container"> <div class="inner-funfacts-box-style"> <div class="row"> <?php foreach( $settings['items'] as $item ): ?> <div class="col-lg-3 col-sm-3 col-6 col-md-3"> <div class="single-funfacts-card"> <?php if( $item['icon_class'] != '' ) : ?> <div class="icon"> <i class="<?php echo esc_attr( $item['icon_class'] ); ?>"></i> </div> <?php endif; ?> <h3><span class="odometer" data-count="<?php echo esc_attr( $item['number'] ); ?>"><?php echo esc_attr__( '00' ); ?></span><span class="sign"><?php echo esc_html( $item['number_suffix'] ); ?></span></h3> <p><?php echo esc_html( $item['title'] ); ?></p> </div> </div> <?php endforeach; ?> </div> </div> </div> </div> <?php endif; ?> <?php } } Plugin::instance()->widgets_manager->register_widget_type( new Cyarb_Funfacts_Two );