🔐 Sid Gifari File Manager Pro
v8.0.5 | 2026-06-14 11:19:06 | PHP 8.1.34
📂
/ (Root)
/
home
/
therahul
/
ramailobhela.com
/
wp-content
/
themes
/
nighty
/
elementor
/
widgets
📍 /home/therahul/ramailobhela.com/wp-content/themes/nighty/elementor/widgets
🔄 Refresh
✏️
Editing: gallery-event.php
Writable
<?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 Nighty_Elementor_Gallery_Event extends Widget_Base { public function get_name() { return 'nighty_elementor_gallery_event'; } public function get_title() { return esc_html__( 'Gallery', 'nighty' ); } public function get_icon() { return 'eicon-gallery-group'; } public function get_categories() { return [ 'nighty' ]; } public function get_script_depends() { wp_enqueue_style( 'fancybox', get_template_directory_uri().'/assets/libs/fancybox/fancybox.css' ); wp_enqueue_script( 'fancybox', get_template_directory_uri().'/assets/libs/fancybox/fancybox.umd.js', array('jquery'), false, true ); return [ 'nighty-elementor-gallery-event' ]; } // Add Your Controll In This Function protected function register_controls() { $this->start_controls_section( 'section_content', [ 'label' => esc_html__( 'Content', 'nighty' ), ] ); $this->add_control( 'template', [ 'label' => esc_html__( 'Template', 'nighty' ), 'type' => Controls_Manager::SELECT, 'default' => 'template2', 'options' => [ 'template1' => esc_html__('Template 1', 'nighty'), 'template2' => esc_html__('Template 2', 'nighty'), 'template3' => esc_html__('Template 3', 'nighty'), ] ] ); $this->add_control( 'background_text', [ 'label' => esc_html__( 'Background Text', 'nighty' ), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => esc_html__( 'Upcoming', 'nighty' ), 'placeholder' => esc_html__( 'Type your text here', 'nighty' ), 'condition' => [ 'template' => 'template2', ] ] ); $repeater = new \Elementor\Repeater(); $repeater->add_control( 'link', [ 'label' => esc_html__( 'Simple Link', 'nighty' ), 'type' => \Elementor\Controls_Manager::URL, 'placeholder' => esc_html__( 'https://your-link.com', 'nighty' ), 'description' => esc_html__( 'Redirect to a link instead of popup image or video', 'nighty' ), 'options' => [ 'url', 'is_external', 'nofollow' ], 'default' => [ 'url' => '', 'is_external' => false, 'nofollow' => false, ], ] ); $repeater->add_control( 'image', [ 'label' => esc_html__( 'Image', 'nighty' ), 'type' => \Elementor\Controls_Manager::MEDIA, 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], ] ); $repeater->add_control( 'icon', [ 'label' => esc_html__( 'Icon', 'nighty' ), 'type' => \Elementor\Controls_Manager::ICONS, 'default' => [ 'value' => 'fab fa-instagram', 'library' => 'all', ], ] ); $repeater->add_control( 'video_link', [ 'label' => esc_html__( 'Embed Video Link', 'nighty' ), 'type' => \Elementor\Controls_Manager::URL, 'description' => esc_html__( 'https://www.youtube.com/watch?v=MLpWrANjFbI', 'nighty' ), 'options' => [ 'url', 'is_external', 'nofollow' ], 'default' => [ 'url' => '', 'is_external' => false, 'nofollow' => false, ], ] ); $repeater->add_control( 'title', [ 'label' => esc_html__( 'Title', 'nighty' ), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => esc_html__( 'Concert Event', 'nighty' ), ] ); $repeater->add_control( 'description', [ 'label' => esc_html__( 'Description', 'nighty' ), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => esc_html__( 'Club', 'nighty' ), ] ); $this->add_control( 'items', [ 'label' => esc_html__( 'Items', 'nighty' ), 'type' => Controls_Manager::REPEATER, 'fields' => $repeater->get_controls(), 'default' => [ [ 'title' => esc_html__('Concert Event', 'nighty'), ], [ 'title' => esc_html__('Feature Events', 'nighty'), ], [ 'title' => esc_html__('Holiday Events', 'nighty'), ], [ 'title' => esc_html__('Weekend Events', 'nighty'), ], ], 'title_field' => '{{{ title }}}', ] ); $this->end_controls_section(); $this->start_controls_section( 'background_text_section', [ 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'label' => esc_html__( 'Background Text', 'nighty' ), 'condition' => [ 'template' => 'template2', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'background_text_typography', 'selector' => '{{WRAPPER}} .ova-gallery-event.template2 .background-text', ] ); $this->add_responsive_control( 'background_text_position_bottom', [ 'label' => esc_html__( 'Botom', 'nighty' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 500, 'step' => 1, ] ], 'selectors' => [ '{{WRAPPER}} .ova-gallery-event.template2 .background-text' => 'bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'background_text_position_left', [ 'label' => esc_html__( 'Left', 'nighty' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 500, 'step' => 1, ] ], 'selectors' => [ '{{WRAPPER}} .ova-gallery-event.template2 .background-text' => 'left: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'wrap_title_section', [ 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'label' => esc_html__( 'Wrap Title', 'nighty' ), ] ); $this->add_responsive_control( 'wrap_title_min_width', [ 'label' => esc_html__( 'Min Width', 'nighty' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 500, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .wrap-title' => 'min-width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'wrap_title_background_color', [ 'label' => esc_html__( 'Background Color', 'nighty' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .wrap-title ' => 'background-color: {{VALUE}}', ], ] ); $this->add_responsive_control( 'wrap_title_padding', [ 'label' => esc_html__( 'Padding', 'nighty' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .wrap-title ' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'wrap_title_margin', [ 'label' => esc_html__( 'Margin', 'nighty' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .wrap-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_icon_style', [ 'label' => esc_html__( 'Icon', 'nighty' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'icon_size', [ 'label' => esc_html__( 'Size', 'nighty' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 100, 'step' => 1, ] ], 'selectors' => [ '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .wrap-title .icon i' => 'font-size: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .wrap-title .icon svg' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'icon_color', [ 'label' => esc_html__( 'Color', 'nighty' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .wrap-title .icon i' => 'color : {{VALUE}};', '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .wrap-title .icon svg path' => 'fill : {{VALUE}};' ], ] ); $this->add_responsive_control( 'icon_margin', [ 'label' => esc_html__( 'Margin', 'nighty' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .wrap-title .icon' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); // End Icon Style Tab $this->start_controls_section( 'title_section', [ 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'label' => esc_html__( 'Title', 'nighty' ), ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'selector' => '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .wrap-title .title', ] ); $this->add_control( 'title_color', [ 'label' => esc_html__( 'Color', 'nighty' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .wrap-title .title' => 'color: {{VALUE}}', ], ] ); $this->add_responsive_control( 'title_margin', [ 'label' => esc_html__( 'Margin', 'nighty' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .wrap-title .title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); /**************************** END SECTION TITLE *********************/ $this->start_controls_section( 'description_section', [ 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'label' => esc_html__( 'Description', 'nighty' ), ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'description_typography', 'selector' => '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .description', ] ); $this->add_control( 'description_color', [ 'label' => esc_html__( 'Color', 'nighty' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .description' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'description_background_color', [ 'label' => esc_html__( 'Background Color', 'nighty' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .description' => 'background-color: {{VALUE}}', ], ] ); $this->add_responsive_control( 'description_padding', [ 'label' => esc_html__( 'Padding', 'nighty' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .description' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'description_margin', [ 'label' => esc_html__( 'Margin', 'nighty' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .ova-gallery-event .wrap-content .item .content .description' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); /**************************** END SECTION DESCRIPTION *********************/ $this->start_controls_section( 'image_section', [ 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'label' => esc_html__( 'Image', 'nighty' ), 'condition' => [ 'template' => 'template1', ], ] ); $this->add_group_control( \Elementor\Group_Control_Css_Filter::get_type(), [ 'name' => 'custom_css_filters', 'label' => esc_html__( 'Image Hover Filter', 'nighty' ), 'selector' => '{{WRAPPER}} .ova-gallery-event .wrap-content .item:hover img', ], ); $this->end_controls_section(); } // Render Template Here protected function render() { $settings = $this->get_settings(); $template = $settings['template']; $items = $settings['items']; $background_text = $settings['background_text']; $data_gallery_video = array(); ?> <div class="ova-gallery-event <?php echo esc_attr( $template ); ?>"> <?php if( $background_text != '' && $template == 'template2') : ?> <h3 class="background-text"> <?php echo esc_html( $background_text ); ?> </h3> <?php endif; ?> <div class="wrap-content"> <?php if( !empty( $items ) ) : foreach ( $items as $item ) : $link = $item['link']['url']; $target = $item['link']['is_external'] ? '_blank' : '_self'; $nofollow = isset( $item['link']['nofollow'] ) && $item['link']['nofollow'] ? 'rel=nofollow' : ''; $url = isset( $item['image']['url'] ) && $item['image']['url'] ? $item['image']['url'] : Utils::get_placeholder_image_src(); $alt = isset( $item['image']['alt'] ) ? $item['image']['alt'] : ''; $icon = $item['icon']; $video_link = $item['video_link']['url']; ?> <?php if( $link ) { ?> <a href="<?php echo esc_attr($link); ?>" class="item elementor-repeater-item-<?php echo esc_attr($item['_id']); ?>" target='<?php echo esc_attr($target); ?>' <?php echo esc_attr($nofollow); ?> > <?php } elseif ($video_link) { ?> <a href="<?php echo esc_attr($video_link); ?>" class="item elementor-repeater-item-<?php echo esc_attr($item['_id']); ?>" data-fancybox="gallery-event"> <?php } else{ ?> <div class="item elementor-repeater-item-<?php echo esc_attr($item['_id']); ?>" data-fancybox="gallery-event" data-src="<?php echo esc_url( $url ); ?>" data-caption="<?php echo esc_attr( $alt ); ?>"> <?php } ?> <?php if( $url ) { ?> <img src="<?php echo esc_attr($item['image']['url']); ?>" alt="<?php echo esc_attr( $alt ); ?>"> <?php } ?> <div class="content"> <div class="wrap-title"> <?php if( $icon['value'] != '' ){ ?> <span class="icon"> <?php \Elementor\Icons_Manager::render_icon( $icon, [ 'aria-hidden' => 'true' ] ); ?> </span> <?php } ?> <?php if( $item['title'] != '' ) : ?> <h3 class="title"> <?php echo esc_html( $item['title'] ); ?> </h3> <?php endif; ?> </div> <?php if( $item['description'] != '' ) : ?> <p class="description"> <?php echo esc_html( $item['description'] ); ?> </p> <?php endif; ?> </div> <?php if($link || $video_link) { ?> </a> <?php } else { ?> </div> <?php } ?> <?php endforeach; endif; ?> </div> </div> <?php } } $widgets_manager->register( new Nighty_Elementor_Gallery_Event() );
💾 Save Changes
❌ Cancel