OwlCyberSecurity - MANAGER
Edit File: box-featured.php
<?php use Elementor\Widget_Base; use Elementor\Controls_Manager; use Elementor\Group_Control_Typography; use Elementor\Utils; use Elementor\Group_Control_Border; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly class Chursy_Elementor_Box_Featured extends Widget_Base { public function get_name() { return 'chursy_elementor_box_featured'; } public function get_title() { return esc_html__( 'Box Featured', 'chursy' ); } public function get_icon() { return 'eicon-flip-box'; } public function get_categories() { return [ 'chursy' ]; } 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', 'chursy' ), ] ); $this->add_control( 'text', [ 'label' => esc_html__( 'Text', 'chursy' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Featured', 'chursy' ), ] ); $this->add_control( 'title', [ 'label' => esc_html__( 'Title', 'chursy' ), 'type' => Controls_Manager::TEXTAREA, 'default' => esc_html__( 'Connect teams and rear collaborate efficiently with church', 'chursy' ), ] ); $this->add_control( 'link_address', [ 'label' => esc_html__( 'Link title', 'chursy' ), 'type' => \Elementor\Controls_Manager::URL, 'show_external' => false, 'default' => [ 'url' => '', 'is_external' => false, 'nofollow' => false, ], ] ); $this->add_control( 'short_desc', [ 'label' => esc_html__( 'Description', 'chursy' ), 'type' => Controls_Manager::TEXTAREA, 'default' => esc_html__( 'Sed ut perspiciatis unde omnis iste natus error sit vol uptatem accusantium doloremque laudantium, total merem aperiam, eaque ipsa quae', 'chursy' ), ] ); $this->add_control( 'date', [ 'label' => esc_html__( 'Date', 'chursy' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( '4 Mar, 2022', 'chursy' ), ] ); $this->add_control( 'category', [ 'label' => esc_html__( 'Category', 'chursy' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Chursy', 'chursy' ), ] ); $this->end_controls_section(); /* General */ $this->start_controls_section( 'items_style_section', [ 'label' => esc_html__( 'General', 'chursy' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'items_max_width', [ 'label' => esc_html__( 'Max Width', 'chursy' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 250, 'max' => 1290, 'step' => 1, ], '%' => [ 'min' => 20, 'max' => 100, 'step' => 1, ], ], 'default' => [ 'unit' => 'px', ], 'selectors' => [ '{{WRAPPER}} .ova-box-featured' => 'max-width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'items_padding', [ 'label' => esc_html__( 'Padding', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ '{{WRAPPER}} .ova-box-featured .item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Box_Shadow::get_type(), [ 'name' => 'items_box_shadow', 'selector' => '{{WRAPPER}} .ova-box-featured .item', ] ); $this->add_control( 'items_bg', [ 'label' => esc_html__( 'Background', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-box-featured .item' => 'background: {{VALUE}}', ], ] ); $this->end_controls_section(); //SECTION TAB STYLE TITLE $this->start_controls_section( 'section_title', [ 'label' => esc_html__( 'Title', 'chursy' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'selector' => '{{WRAPPER}} .ova-box-featured .post-title', ] ); $this->add_control( 'color_title', [ 'label' => esc_html__( 'Color', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-box-featured .post-title a' => 'color : {{VALUE}};', ], ] ); $this->add_control( 'color_title_hover', [ 'label' => esc_html__( 'Color Hover', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-box-featured .post-title a:hover' => 'color : {{VALUE}};', ], ] ); $this->add_responsive_control( 'margin_title', [ 'label' => esc_html__( 'Margin', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-box-featured .post-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); //END SECTION TAB STYLE TITLE /* Short Description */ $this->start_controls_section( 'section_short_desc', [ 'label' => esc_html__( 'Short Description', 'chursy' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'short_desc_typography', 'selector' => '{{WRAPPER}} .ova-box-featured .short_desc', ] ); $this->add_control( 'color_short_desc', [ 'label' => esc_html__( 'Color', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-box-featured .short_desc, {{WRAPPER}} .ova-box-featured .short_desc p' => 'color : {{VALUE}};', ], ] ); $this->add_responsive_control( 'margin_short_desc', [ 'label' => esc_html__( 'Margin', 'chursy' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-box-featured .short_desc' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); /* Meta */ $this->start_controls_section( 'section_meta', [ 'label' => esc_html__( 'Meta', 'chursy' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'meta_text_typography', 'selector' => '{{WRAPPER}} .ova-box-featured .item .post-meta .item-meta .right', ] ); $this->add_control( 'meta_text_color', [ 'label' => esc_html__( 'Color', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-box-featured .item .post-meta .item-meta .right, {{WRAPPER}} .ova-box-featured .item .post-meta .item-meta .right a' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'meta_text_color_hover', [ 'label' => esc_html__( 'Link Hover', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-box-featured .item .post-meta .item-meta .right a:hover' => 'color: {{VALUE}}', ], ] ); $this->end_controls_section(); /* Category */ $this->start_controls_section( 'section_category', [ 'label' => esc_html__( 'Category', 'chursy' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'category_typography', 'selector' => '{{WRAPPER}} .ova-box-featured .item .category', ] ); $this->add_control( 'color_category', [ 'label' => esc_html__( 'Color', 'chursy' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-box-featured .item .category' => 'color : {{VALUE}};', ], ] ); $this->end_controls_section(); } // Render Template Here protected function render() { $settings = $this->get_settings_for_display(); $text = $settings['text']; $title = $settings['title']; $short_desc = $settings['short_desc']; $date = $settings['date']; $category = $settings['category']; $link = $settings['link_address']['url']; $target = $settings['link_address']['is_external'] ? ' target="_blank"' : ''; ?> <div class="ova-box-featured"> <div class="item"> <div class="info"> <?php if( !empty($text) ) { ?> <span class="text"> <?php echo esc_html( $text ); ?> </span> <?php } ?> <?php if ( !empty($title) ) { ?> <h2 class="post-title"> <?php if( $link ) { ?> <a href="<?php echo esc_url( $link ); ?>"<?php printf( $target ); ?>> <?php } ?> <?php echo esc_html($title); ?> <?php if( $link ) { ?> </a> <?php } ?> </h2> <?php } ?> <?php if ( $short_desc ) { ?> <div class="short_desc"> <?php echo esc_html($short_desc); ?> </div> <?php } ?> <div class="post-bottom"> <?php if( !empty($date) ) { ?> <ul class="post-meta"> <li class="item-meta post-date"> <span class="right date"> <?php echo esc_html($date); ?> </span> </li> </ul> <?php } ?> <?php if( !empty($category) ) { ?> <span class="category"> <?php echo esc_html( $category ); ?> </span> <?php } ?> </div> </div> </div> </div> <?php } } $widgets_manager->register( new Chursy_Elementor_Box_Featured() );