first commit

This commit is contained in:
Roman Pyrih
2024-12-19 15:27:13 +01:00
commit d6241cfa7a
21694 changed files with 6902106 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
<?php
/**
* Plugin Name: Custom Gallery
* Description: Simple hello world widgets for Elementor.
* Version: 1.0.0
* Author: Elementor Developer
* Author URI: https://developers.elementor.com/
* Text Domain: elementor-addon
*
* Requires Plugins: elementor
* Elementor tested up to: 3.21.0
* Elementor Pro tested up to: 3.21.0
*/
function register_custom_gallery_widget( $widgets_manager ) {
require_once( __DIR__ . '/widgets/custom-gallery.php' );
$widgets_manager->register( new \Elementor_Custom_Gallery() );
}
add_action( 'elementor/widgets/register', 'register_custom_gallery_widget' );

View File

@@ -0,0 +1,105 @@
<?php
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
class Elementor_Custom_Gallery extends \Elementor\Widget_Base {
public function get_name() {
return 'custom gallery';
}
public function get_title() {
return esc_html__( 'custom gallery', 'elementor-addon' );
}
public function get_icon() {
return 'eicon-code';
}
public function get_categories() {
return [ 'basic' ];
}
public function get_keywords() {
return [ 'gallery', 'images' ];
}
/**
* Register image gallery widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @since 3.1.0
* @access protected
*/
protected function register_controls() {
$this->start_controls_section(
'section_gallery',
[
'label' => esc_html__( 'Image Gallery', 'elementor' ),
]
);
$this->add_control(
'wp_gallery',
[
'label' => esc_html__( 'Add Images', 'elementor' ),
'type' => \Elementor\Controls_Manager::GALLERY,
'show_label' => false,
'dynamic' => [
'active' => true,
],
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
$gallery = $settings['wp_gallery'];
echo "<div class='custom-gallery'>";
echo "<div class='top'>";
echo "<div class='left'>";
if ( $gallery[0]['url'] ) {
echo "<a href='{$gallery[0]['url']}' data-elementor-open-lightbox='yes' data-elementor-lightbox-slideshow='111111'>";
echo "<img src='{$gallery[0]['url']}' alt='{$gallery[0]['title']}'>";
echo "</a>";
}
echo "</div>";
echo "<div class='right'>";
if ( $gallery[1]['url'] ) {
echo "<a href='{$gallery[1]['url']}' data-elementor-open-lightbox='yes' data-elementor-lightbox-slideshow='111111'>";
echo "<img src='{$gallery[1]['url']}' alt='{$gallery[1]['title']}'>";
echo "</a>";
}
if ( $gallery[2]['url'] ) {
echo "<a href='{$gallery[2]['url']}' data-elementor-open-lightbox='yes' data-elementor-lightbox-slideshow='111111'>";
echo "<img src='{$gallery[2]['url']}' alt='{$gallery[2]['title']}'>";
echo "</a>";
}
echo "</div>";
echo "</div>";
if ( count ( $gallery ) > 3 ) {
echo "<div class='bottom'>";
for ( $i = 3; $i < count( $gallery ); $i++ ) {
if ( $gallery[$i]['url'] and $i < 9 ) {
echo "<a href='{$gallery[$i]['url']}' data-elementor-open-lightbox='yes' data-elementor-lightbox-slideshow='111111'>";
echo "<img src='{$gallery[$i]['url']}' alt='{$gallery[$i]['title']}'>";
echo "</a>";
}
}
echo "</div>";
for ( $i = 9; $i < count( $gallery ); $i++ ) {
if ( $gallery[$i]['url'] ) {
echo "<a href='{$gallery[$i]['url']}' data-elementor-open-lightbox='yes' data-elementor-lightbox-slideshow='111111' class='hidden'>";
echo "<img src='{$gallery[$i]['url']}' alt='{$gallery[$i]['title']}'>";
echo "</a>";
}
}
}
echo "</div>";
}
}