Save
This commit is contained in:
15
wp-content/plugins/elementor-addon/assets/css/main.css
Normal file
15
wp-content/plugins/elementor-addon/assets/css/main.css
Normal file
@@ -0,0 +1,15 @@
|
||||
.elementor-widget-images-list ul {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
}
|
||||
.elementor-widget-images-list ul li img {
|
||||
width: 100%;
|
||||
max-width: 20px;
|
||||
height: auto;
|
||||
max-height: 12px;
|
||||
}/*# sourceMappingURL=main.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["main.scss","main.css"],"names":[],"mappings":"AACC;EACC,UAAA;EACA,SAAA;EACA,gBAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,QAAA;ACAF;ADGG;EACC,WAAA;EACA,eAAA;EACA,YAAA;EACA,gBAAA;ACDJ","file":"main.css"}
|
||||
20
wp-content/plugins/elementor-addon/assets/css/main.scss
Normal file
20
wp-content/plugins/elementor-addon/assets/css/main.scss
Normal file
@@ -0,0 +1,20 @@
|
||||
.elementor-widget-images-list {
|
||||
ul {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
|
||||
li {
|
||||
img {
|
||||
width: 100%;
|
||||
max-width: 20px;
|
||||
height: auto;
|
||||
max-height: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
47
wp-content/plugins/elementor-addon/elementor-addon.php
Normal file
47
wp-content/plugins/elementor-addon/elementor-addon.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: Elementor Addon
|
||||
* 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_hello_world_widget( $widgets_manager ) {
|
||||
|
||||
require_once( __DIR__ . '/widgets/images-list.php' );
|
||||
|
||||
$widgets_manager->register( new \Elementor_Images_List() );
|
||||
}
|
||||
add_action( 'elementor/widgets/register', 'register_hello_world_widget' );
|
||||
|
||||
function enqueue_elementor_addon_styles() {
|
||||
if ( did_action( 'elementor/loaded' ) ) {
|
||||
wp_enqueue_style(
|
||||
'elementor-addon-main-css',
|
||||
plugins_url( 'assets/css/main.css', __FILE__ ),
|
||||
[],
|
||||
'1.0.0'
|
||||
);
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'enqueue_elementor_addon_styles' );
|
||||
|
||||
|
||||
function enqueue_elementor_addon_scripts() {
|
||||
if ( did_action( 'elementor/loaded' ) ) {
|
||||
wp_enqueue_script(
|
||||
'elementor-addon-main-js',
|
||||
plugins_url( 'assets/js/main.js', __FILE__ ),
|
||||
[ 'jquery' ],
|
||||
'1.0.0',
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'enqueue_elementor_addon_scripts' );
|
||||
105
wp-content/plugins/elementor-addon/widgets/images-list.php
Normal file
105
wp-content/plugins/elementor-addon/widgets/images-list.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
use Elementor\Controls_Manager;
|
||||
use Elementor\Icons_Manager;
|
||||
use Elementor\Repeater;
|
||||
use Elementor\Utils;
|
||||
|
||||
class Elementor_Images_List extends \Elementor\Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'images-list';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__('Images List', 'elementor-addon');
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'eicon-code';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return ['basic'];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return ['global', 'login'];
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
$this->start_controls_section(
|
||||
'list_section',
|
||||
[
|
||||
'label' => esc_html__('List', 'elementor-addon'),
|
||||
]
|
||||
);
|
||||
|
||||
$repeater = new Repeater();
|
||||
|
||||
$repeater->add_control(
|
||||
'image',
|
||||
[
|
||||
'label' => esc_html__('Image', 'elementor-addon'),
|
||||
'type' => Controls_Manager::MEDIA,
|
||||
'default' => [
|
||||
'url' => Utils::get_placeholder_image_src(),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$repeater->add_control(
|
||||
'URL',
|
||||
[
|
||||
'label' => esc_html__('URL', 'elementor-addon'),
|
||||
'type' => Controls_Manager::URL,
|
||||
'default' => [
|
||||
'url' => '#',
|
||||
],
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'images',
|
||||
[
|
||||
'label' => esc_html__('Images', 'elementor-addon'),
|
||||
'type' => Controls_Manager::REPEATER,
|
||||
'fields' => $repeater->get_controls(),
|
||||
'default' => [
|
||||
[
|
||||
'image' => [
|
||||
'url' => Utils::get_placeholder_image_src(),
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
$settings = $this->get_settings_for_display();
|
||||
|
||||
if (empty($settings['images'])) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<ul>
|
||||
<?php foreach ($settings['images'] as $image) : ?>
|
||||
<li>
|
||||
<a href="<?php echo $image['URL']['url']; ?>" <?php echo $image['URL']['is_external'] ? 'target="_blank"' : ''; ?>>
|
||||
<img src="<?php echo $image['image']['url']; ?>">
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user